def fmt_date_or_none(date, fmt='%Y-%m-%d'):
    if date:
        try:
            return date.strftime(fmt)
        except __HOLE__:
            raise HTTPError(
                http.BAD_REQUEST,
                data=dict(message_long='Year entered must be after 1900')
            )
    return None
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/profile/views.py/fmt_date_or_none