def parse_description(s):
    today = datetime.date.today()
    if s == 'today':
        return today
    elif s == 'yesterday':
        return today - relativedelta(days=1)
    else:
        match = re.match('(\d+)daysAgo', s)
        if match:
            return today - relativedelta(days=int(match.group(1)))
        else:
            raise ValueError("Can only parse descriptions of the format: today, yesterday, ndaysAgo")
dataset/ETHPy150Open debrouwere/google-analytics/googleanalytics/utils/date.py/parse_description/original