Human: Give me a Python function to convert datetime to iso string. Assistant: 
Here is a Python function to convert datetime to iso string

import datetime

def datetime_to_iso(dt):
    """
    Converts datetime to iso string.
    """
    return dt.isoformat()

# Enter the datetime
dt = datetime.datetime(2019, 1, 1)

# Calling the function
print((datetime_to_iso(dt)))

#Example Output
# 2019-01-01T00:00:00

#Remember to inspect code for bugs.