human
Can you show me a Python function to convert datetime to string.
assistant
Here is a Python function to convert datetime to string

import datetime

def datetime_to_string(dt):
    """Convert datetime to string"""
    return dt.strftime("%Y-%m-%d %H:%M:%S")

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

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

#Example Output
# 2018-01-01 01:01:01

#Remember to inspect code for bugs.