<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _format_with_same_year_and_month(format_specifier):
 """ Return a version of `format_specifier` that renders a date assuming it has the same year and month as another date. Usually this means ommitting the year and month. This can be overridden by specifying a format that has `_SAME_YEAR_SAME_MONTH` appended to the name in the project's `formats` spec. """

    test_format_specifier = format_specifier + "_SAME_YEAR_SAME_MONTH"
    test_format = get_format(test_format_specifier, use_l10n=True)
    if test_format == test_format_specifier:
        # this format string didn't resolve to anything and may be a raw format.
        # Use a regex to remove year and month markers instead.
        no_year = re.sub(YEAR_RE, '', get_format(format_specifier))
        return re.sub(MONTH_RE, '', no_year)
    else:
        return test_format