def METHOD_NAME(d, dayfirst=True):
    '''
    attempt to parse a date string using pandas date parser. If ambiguous,
    the argument 'dayfirst' determines whether month or day is assumed to be
    the first field. Incomplete dates will be padded with XX.
    On failure to parse the date, the function will return the input.
    '''
    try:
        from pandas.core.tools.datetimes import parsing
        results = parsing.parse_time_string(d, dayfirst=dayfirst)
        if len(results) == 2:
            dto, res = results
        else:
            dto, _, res = results
        if res == 'year':
            return "%d-XX-XX"%dto.year
        elif res == 'month':
            return "%d-%02d-XX"%(dto.year, dto.month)
        else:
            return "%d-%02d-%02d"%(dto.year, dto.month, dto.day)
    except ValueError as e:
        # If the date can't be parsed by pandas above or as our own ambiguous
        # date format (e.g., "2020-XX-XX"), let the user know.
        try:
            parsed_date = get_numerical_date_from_value(d, "%Y-%m-%d")
        except ValueError:
            parsed_date = None
        if parsed_date is None:
            print("WARNING: unable to parse %s as date"%d, e, file=sys.stderr)
        return d