import datetime as _datetime


def _get_last_month(datetime):
    """Return the date at the start of the month before 'datetime', e.g.
    _get_last_month(March 21st) will return February 1st
    """

    datetime = datetime.replace(day=1) - _datetime.timedelta(days=1)
    return _datetime.datetime(year=datetime.year, month=datetime.month, day=1, tzinfo=datetime.tzinfo)