def METHOD_NAME(timestamp):
    # Takes a timestamp string and returns a datetime object
    try:
        time_object = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S%z")
    except ValueError:
        # If no start and end time is specified the format string must be different
        time_object = datetime.strptime(timestamp, "%Y-%m-%d")
    return time_object