def _to_date(t):
    '''
    Internal function that tries whatever to convert ``t`` into a
    :class:`datetime.date` object.

    >>> _to_date('2013-12-11')
    datetime.date(2013, 12, 11)
    >>> _to_date('Wed, 11 Dec 2013')
    datetime.date(2013, 12, 11)
    >>> _to_date('Wed, 11 Dec 13')
    datetime.date(2013, 12, 11)
    '''

    if isinstance(t, six.integer_types + (float, )):
        return datetime.date.fromtimestamp(t)

    elif isinstance(t, six.string_types):
        for date_format in ALL_DATE_FORMATS:
            try:
                return datetime.datetime.strptime(t, date_format).date()
            except ValueError:
                pass

        raise ValueError('Format not supported')

    elif isinstance(t, datetime.datetime):
        return t.date()

    elif isinstance(t, datetime.date):
        return t

    else:
        raise TypeError