import re


def _fix_quarter_values(value):
    """Make raw quarter values Pandas-friendly (e.g. 'Q4-2018' -> '2018Q4')."""
    m = re.match(r"Q([1-4])-(\d\d\d\d)", value)
    if not m:
        return value
    quarter, year = m.groups()
    value = "%sQ%s" % (quarter, year)
    return value