from datetime import datetime


def instantiate_datetime_object(datetime_stamps):
    """Takes a datestamp as a string and instatiates it into an object.

    >>> datetime_stamps = [u'2016-09-10T15:35-07:00', u'2016-09-10T16:48-07:00']
    >>> instantiate_datetime_object(datetime_stamps)
    [datetime.datetime(2016, 9, 10, 15, 35, 7), datetime.datetime(2016, 9, 10, 16, 48, 7)]

    >>> datetime_stamps = [u'2016-09-10T15:35-07:00']
    >>> instantiate_datetime_object(datetime_stamps)
    [datetime.datetime(2016, 9, 10, 15, 35, 7)]

    >>> datetime_stamps = [u'2016-09-10T15:35+07:00']
    >>> instantiate_datetime_object(datetime_stamps)
    [datetime.datetime(2016, 9, 10, 15, 35, 7)]

    """

    all_datetime_stamps = []

    parse_date_format1 = "%Y-%m-%dT%H:%M+%S:%f"
    parse_date_format2 = "%Y-%m-%dT%H:%M-%S:%f"

    for datetime_stamp in datetime_stamps:
        if "+" in datetime_stamp:
            datetime_object = datetime.strptime(datetime_stamp, parse_date_format1)
            all_datetime_stamps.append(datetime_object)
        else:
            datetime_object = datetime.strptime(datetime_stamp, parse_date_format2)
            all_datetime_stamps.append(datetime_object)

    return all_datetime_stamps