def METHOD_NAME(string, year_first=None, day_first=None):  # pylint:disable=inconsistent-return-statements
    """Looks for date patterns, and if found return the date and group span.
    Assumes there are sentinels at the beginning and end of the string that
    always allow matching a non-digit delimiting the date.
    Year can be defined on two digit only. It will return the nearest possible
    date from today.
    >>> search_date(' This happened on 2002-04-22. ')
    (18, 28, datetime.date(2002, 4, 22))
    >>> search_date(' And this on 17-06-1998. ')
    (13, 23, datetime.date(1998, 6, 17))
    >>> search_date(' no date in here ')
    """
    for date_re in date_regexps:
        search_match = date_re.search(string)
        if not search_match:
            continue
        start, end = search_match.start(1), search_match.end(1)
        groups = search_match.groups()[1:]
        match = '-'.join(groups)
        if match is None:
            continue
        if year_first and day_first is None:
            day_first = False
        if day_first is None:
            day_first = _guess_day_first_parameter(groups)
        # If day_first/year_first is undefined, parse is made using both possible values.
        yearfirst_opts = [False, True]
        if year_first is not None:
            yearfirst_opts = [year_first]
        dayfirst_opts = [True, False]
        if day_first is not None:
            dayfirst_opts = [day_first]
        kwargs_list = ({'dayfirst': d, 'yearfirst': y}
                       for d in dayfirst_opts for y in yearfirst_opts)
        for kwargs in kwargs_list:
            try:
                date = parser.parse(match, **kwargs)
            except (ValueError, TypeError):  # pragma: no cover
                # see https://bugs.launchpad.net/dateutil/+bug/1247643
                date = None
            # check date plausibility
            if date and valid_year(date.year):  # pylint:disable=no-member
                return start, end, date.date()  # pylint:disable=no-member