from datetime import datetime


def parse_date(date_str) :
    """
    Converts a date-time string into a datetime object.
    """
    if len(date_str) > 19:
        return datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%f')
    else :
        return datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S')