def parse(date, dayfirst=True):
    '''Parse a `date` into a `FlexiDate`.

    @param date: the date to parse - may be a string, datetime.date,
    datetime.datetime or FlexiDate.

    TODO: support for quarters e.g. Q4 1980 or 1954 Q3
    TODO: support latin stuff like M.DCC.LIII
    TODO: convert '-' to '?' when used that way
        e.g. had this date [181-]
    '''
    if not date:
        return None
    if isinstance(date, FlexiDate):
        return date
    if isinstance(date, int):
        return FlexiDate(year=date)
    elif isinstance(date, datetime.datetime):
        parser = PythonDateTimeParser()
        return parser.parse(date)
    elif isinstance(date, datetime.date):
        parser = PythonDateParser()
        return parser.parse(date)
    else:  # assuming its a string
        parser = DateutilDateParser()
        out = parser.parse(date, **{'dayfirst': dayfirst})
        if out is not None:
            return out
        # msg = 'Unable to parse %s' % date
        # raise ValueError(date)
        val = 'UNPARSED: %s' % date
        val = val.encode('ascii', 'ignore')
        return FlexiDate(qualifier=val)
Parse a `date` into a `FlexiDate`.

    @param date: the date to parse - may be a string, datetime.date,
    datetime.datetime or FlexiDate.

    TODO: support for quarters e.g. Q4 1980 or 1954 Q3
    TODO: support latin stuff like M.DCC.LIII
    TODO: convert '-' to '?' when used that way
        e.g. had this date [181-]