<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def to_datetime(time):
    '''Convert `time` to a datetime.'''
    if type(time) == IntType or type(time) == LongType:
        time = datetime.fromtimestamp(time // 1000)
    return time