<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def timeformat(timeobject, timeformat):
 """ 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 """

    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")