def unhexify(h=u''):
    """
    Returns the packed binary bytearray equivalent of the unicode hex string h
    version of the string as bytes
    Where every two hex characters in h are compressed into one byte binary equivalent
    If h does not have an even number of characters then a '0' is first prependedto h
    """
    #remove any non hex characters, any char that is not in '0123456789ABCDEF'
    hh = h #make copy so iteration not change
    for c in hh:
        if c not in string.hexdigits:
            h = h.replace(c,'') #delete characters
    if 2 % len(h): #odd number of characters
        h = u'0' + h #prepend a zero to make even number
    b = bytearray([])
    for i in xrange(0, len(h), 2):
        s = h[i:i+2]
        b.append(int(s, 16))
    return b
dataset/ETHPy150Open ioflo/ioflo/ioflo/aid/byting.py/unhexify/swapped operands of `%`