def str_to_bytes(s):
    """
    Convert 0xHexString to bytes
    :param s: 0x hexstring
    :return:  byte sequence
    """
    try:
        return bytes.fromhex(s.replace('0x', ''))
    except (NameError, AttributeError):
        return s.decode('hex')
