def METHOD_NAME(timestamp, filter_name):
    try:
        filter_date = datetime.strptime(timestamp, DATETIME_FORMAT)
    except ValueError:
        raise ValidationError("%(filter_name)s='%(ts)s' not a valid timestamp "
                              "of format: %(format)s"
                              % {"ts": timestamp,
                                 "format": DATETIME_FORMAT,
                                 "filter_name": filter_name})
    yield filter_date