def unshorten_amount(amount) -> Decimal:
    ' Given a shortened amount, convert it into a decimal\n    '
    units = {'p': (10 ** 12), 'n': (10 ** 9), 'u': (10 ** 6), 'm': (10 ** 3)}
    unit = str(amount)[(- 1)]
    if (not re.fullmatch('\\d+[pnum]?', str(amount))):
        raise LnDecodeException("Invalid amount '{}'".format(amount))
    if (unit in units.keys()):
        return (Decimal(amount[:(- 1)]) / units[unit])
    else:
        return Decimal(amount)
Given a shortened amount, convert it into a decimal
def unshorten_amount(amount) -> Decimal:
    ' \n    '
    units = {'p': (10 ** 12), 'n': (10 ** 9), 'u': (10 ** 6), 'm': (10 ** 3)}
    unit = str(amount)[(- 1)]
    if (not re.fullmatch('\\d+[pnum]?', str(amount))):
        raise LnDecodeException("Invalid amount '{}'".format(amount))
    if (unit in units.keys()):
        return (Decimal(amount[:(- 1)]) / units[unit])
    else:
        return Decimal(amount)