

def range(start, stop=None, months=0, days=0, format='date'):
    start = date(start, utc=True)
    stop = date(stop, utc=True)
    if (days or months):
        if start:
            stop = (start + relativedelta(days=(days - 1), months=months))
        elif stop:
            start = (stop - relativedelta(days=(days - 1), months=months))
        else:
            raise ValueError('Cannot construct a date range from months or days                 without specifying start or stop.')
    else:
        stop = (stop or start)
    if (format in formats):
        format = formats[format]
    else:
        raise ValueError('{} is an unrecognized date format. Choose from: {}'.format(format, ', '.join(formats)))
    return (format(start), format(stop))

dataset/ETHPy150Open debrouwere/facebook-insights/facebookinsights/utils/date.py range/original