def savings_rate(take_home_pay, spending, numtype='<STR_LIT:float>'):
if numtype == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>return (<EOL>(Decimal(take_home_pay) - Decimal(spending)) / (Decimal(take_home_pay))<EOL>) * Decimal(<NUM_LIT>)<EOL><DEDENT>except (InvalidOperation, DivisionByZero):<EOL><INDENT>return Decimal(<NUM_LIT:0.0>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>return (<EOL>(float(take_home_pay) - float(spending)) / (float(take_home_pay))<EOL>) * <NUM_LIT><EOL><DEDENT>except (ZeroDivisionError):<EOL><INDENT>return <NUM_LIT:0.0><EOL><DEDENT><DEDENT>
Calculate net take-home pay including employer retirement savings match
using the formula laid out by Mr. Money Mustache:
http://www.mrmoneymustache.com/2015/01/26/calculating-net-worth/

Args:
    take_home_pay: float or int, monthly take-home pay

    spending: float or int, monthly spending

    numtype: string, 'decimal' or 'float'; the type of number to return.

Returns:
    your monthly savings rate expressed as a percentage.