code: def fix_val(value):
      
      if type(value) == bytes:
          return value
  
      if sys.version_info[0] == 2:
          return bytes(value)
      elif type(value) == str:
          return bytes(value, 'UTF-8')
      else:
          return bytes(str(value), 'ASCII')
docs: Make a FIX value from a string, bytes, or number.