import decimal


def _parse_numbers(text):
    """
    Convert a string to a number, allowing for a K|M|G|T postfix, 32.8K.
    Returns a decimal number if the string is a real number,
    or the string unchanged otherwise.
    """
    if text.isdigit():
        return decimal.Decimal(text)

    try:
        postPrefixes = {
            "K": "10E3",
            "M": "10E6",
            "G": "10E9",
            "T": "10E12",
            "P": "10E15",
            "E": "10E18",
            "Z": "10E21",
            "Y": "10E24",
        }
        if text[-1] in postPrefixes.keys():
            v = decimal.Decimal(text[:-1])
            v = v * decimal.Decimal(postPrefixes[text[-1]])
            return v
        else:
            return decimal.Decimal(text)
    except ValueError:
        return text