def replace_assign(match):
    """Replace a pretty assignment, e.g. ``B = 1 T``, by valid Python code using
    a Quantity call.
    """
    return '%s = Quantity(\'%s\')' % (match.group(1), match.group(2))