Returns the best named option for the inputted date based on the inputted
    date name.
    
    :param      date    | <datetime.date>
                options | <projex.dates.Names> || None
    
    :return     <projex.dates.Names>

def named(date, options=None):
    """
    Returns the best named option for the inputted date based on the inputted
    date name.
    
    :param      date    | <datetime.date>
                options | <projex.dates.Names> || None
    
    :return     <projex.dates.Names>
    """
    # map from Qt information
    if type(date).__name__ in ('QDate', 'QDateTime', 'QTime'):
        date = date.toPython()

    if options is None:
        options = Names.all()

    # use the date information
    if isinstance(date, datetime.datetime):
        date = date.date()

    # grab today's information
    today = datetime.date.today()
    today_month = today.month
    today_year, today_week, today_weekday = today.isocalendar()

    # grab yesterday's information
    yesterday = today + datetime.timedelta(days=-1)
    tomorrow = today + datetime.timedelta(days=1)

    # grab the date information
    date_month = date.month
    date_year, date_week, date_weekday = date.isocalendar()

    # look for today
    if today == date and Names.Today & options:
        return Names.Today

    # look for yesterday
    elif yesterday == date and Names.Yesterday & options:
        return Names.Yesterday

    # look for tomorrow
    elif tomorrow == date and Names.Tomorrow & options:
        return Names.Tomorrow

    # look for same year options
    elif today_year == date_year:
        # look for same month options
        if today_month == date_month:
            # look for this week
            if today_week == date_week and Names.ThisWeek & options:
                return Names.ThisWeek

            # look for last week 
            elif today_week == date_week + 1 and Names.LastWeek & options:
                return Names.LastWeek

            # look for next week
            elif today_week == date_week - 1 and Names.NextWeek & options:
                return Names.NextWeek

            # look for this month
            elif Names.ThisMonth & options:
                return Names.ThisMonth

        # look for last month options
        elif today_month == date_month + 1 and Names.LastMonth & options:
            return Names.LastMonth

        # look for next month options
        elif today_month == date_month - 1 and Names.NextMonth & options:
            return Names.NextMonth

        # look for this year options
        elif Names.ThisYear & options:
            return Names.ThisYear

    # look for last year options
    elif today_year == date_year + 1 and Names.LastYear & options:
        return Names.LastYear

    # look for next year options
    elif today_year == date_year - 1 and Names.NextYear & options:
        return Names.NextYear

    # look for past dates
    elif date < today and Names.Past & options:
        return Names.Past

    # look for future dates
    elif today < date and Names.Future & options:
        return Names.Future

    return Names.Sometime