def parse(datetime_str, timezone=None, dayfirst=True, yearfirst=True):
    dt = capture(datetime_str, dayfirst=dayfirst, yearfirst=yearfirst)

    if timezone:
        dt = dt.replace(tzinfo=None)
        do = Delorean(datetime=dt, timezone=timezone)
    elif dt.tzinfo is None:
        # assuming datetime object passed in is UTC
        do = Delorean(datetime=dt, timezone='UTC')
    elif isinstance(dt.tzinfo, tzoffset):
        utcoffset = dt.tzinfo.utcoffset(None)
        total_seconds = (
            (utcoffset.microseconds + (utcoffset.seconds + utcoffset.days * 24 * 3600) * 10**6) / 10**6)

        tz = pytz.FixedOffset(total_seconds / 60)
        dt = dt.replace(tzinfo=None)
        do = Delorean(dt, timezone=tz)
    elif isinstance(dt.tzinfo, tzlocal):
        tz = get_localzone()
        dt = dt.replace(tzinfo=None)
        do = Delorean(dt, timezone=tz)
    else:
        dt = pytz.utc.normalize(dt)
        # makeing dt naive so we can pass it to Delorean
        dt = dt.replace(tzinfo=None)
        # if parse string has tzinfo we return a normalized UTC
        # delorean object that represents the time.
        do = Delorean(datetime=dt, timezone='UTC')

    return do
Parses a datetime string and returns a `Delorean` object.
dataset/ETHPy150Open myusuf3/delorean/delorean/interface.py/parse