<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def datetime_to_iso(date, only_date=True):
 """ Convert datetime format to ISO 8601 time format This function converts a date in datetime instance, e.g. ``datetime.datetime(2017,9,14,0,0)`` to ISO format, e.g. ``2017-09-14`` :param date: datetime instance to convert :type date: datetime :param only_date: whether to return date only or also time information. Default is ``True`` :type only_date: bool :return: date in ISO 8601 format :rtype: str """

    if only_date:
        return date.isoformat().split('T')[0]
    return date.isoformat()