<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def in_words(amount, gender=None):
 """ In-words representation of amount. Parameter is a gender: MALE, FEMALE or NEUTER Examples:: {{ some_int|in_words }} {{ some_other_int|in_words:FEMALE }} """

    try:
        res = numeral.in_words(amount, getattr(numeral, str(gender), None))
    except Exception as err:
        # because filter must die silently
        res = default_value % {'error': err, 'value': str(amount)}
    return res