def to_bytes(st, encoding='utf-8'):
    if isinstance(st, unicode):
      return st.encode(encoding)
    elif isinstance(st, bytes):
      return st
    else:
      raise ValueError(type(st) % 'Cannot convert %s to bytes')
dataset/ETHPy150Open pantsbuild/pex/pex/compatibility.py/to_bytes/swapped operands of `%`