code: def timeformat(timeobject, timeformat):
      
      if timeformat == "unix":
          return to_UNIXtime(timeobject)
      elif timeformat == "iso":
          return to_ISO8601(timeobject)
      elif timeformat == "date":
          return to_date(timeobject)
      else:
          raise ValueError("Invalid value for timeformat parameter")
docs: Formats the specified time object to the target format type.
  
      :param timeobject: the object conveying the time value
      :type timeobject: int, ``datetime.datetime`` or ISO8601-formatted
          string with pattern ``YYYY-MM-DD HH:MM:SS+00``
      :param timeformat: the target format for the time conversion. May be:
          '*unix*' (outputs an int UNIXtime), '*date*' (outputs a
          ``datetime.datetime`` object) or '*iso*' (outputs an ISO8601-formatted
          string with pattern ``YYYY-MM-DD HH:MM:SS+00``)
      :type timeformat: str
      :returns: the formatted time
      :raises: ValueError when unknown timeformat switches are provided or
          when negative time values are provided