import sys


def to_hex(value):
    if sys.version_info.major < 3:
        return value.encode('hex')
    return "".join("%02x" % b for b in value)


def from_hex(value):
    if sys.version_info.major < 3:
        return value.decode('hex')
    return bytes.fromhex(value)

# vim: set ts=4 sw=4 tw=80:

import sys


def to_hex(value):
    if sys.version_info.major < 3:
        return value.encode('hex')
    return "".join("%02x" % b for b in value)


def from_hex(value):
    if sys.version_info.major < 3:
        return value.decode('hex')
    return bytes.fromhex(value)

def swap_bytes(value):
    if sys.version_info.major < 3:
        return "".join([bytes(b) for b in reversed(value)])
    return bytes(reversed(value))

# vim: set ts=4 sw=4 tw=80:

Add function to swap byte order
Add function to swap byte order

  import sys
  
  
  def to_hex(value):
      if sys.version_info.major < 3:
          return value.encode('hex')
      return "".join("%02x" % b for b in value)
  
  
  def from_hex(value):
      if sys.version_info.major < 3:
          return value.decode('hex')
      return bytes.fromhex(value)
  
+ def swap_bytes(value):
+     if sys.version_info.major < 3:
+         return "".join([bytes(b) for b in reversed(value)])
+     return bytes(reversed(value))
+ 
  # vim: set ts=4 sw=4 tw=80:
  
Add function to swap byte order
## Code Before:
import sys


def to_hex(value):
    if sys.version_info.major < 3:
        return value.encode('hex')
    return "".join("%02x" % b for b in value)


def from_hex(value):
    if sys.version_info.major < 3:
        return value.decode('hex')
    return bytes.fromhex(value)

# vim: set ts=4 sw=4 tw=80:

## Instruction:
Add function to swap byte order
## Code After:
import sys


def to_hex(value):
    if sys.version_info.major < 3:
        return value.encode('hex')
    return "".join("%02x" % b for b in value)


def from_hex(value):
    if sys.version_info.major < 3:
        return value.decode('hex')
    return bytes.fromhex(value)

def swap_bytes(value):
    if sys.version_info.major < 3:
        return "".join([bytes(b) for b in reversed(value)])
    return bytes(reversed(value))

# vim: set ts=4 sw=4 tw=80:
