def byte_literal(b):
    """ If b is already a byte literal, return it. Otherwise, b is 
        an integer which should be converted to a byte literal.

        This function is for compatibility with Python 2.6 and 3.x
    """
    if isinstance(b, int):
        return bytes([b])
    else:
        return b