code: def to_hex(x):
      
      if isinstance(x, bytearray):
          x = bytes(x)
      elif isinstance(x, (list, tuple)):
          x = bytes(bytearray(x))
      if isinstance(x, basestring):
          return base64.b16encode(x).decode('ascii')
      else:
          raise ValueError('Unknown input argument type')
docs: Converts input to the hex string
      :param x:
      :return: