<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def two_numbers(
            cls, request,
            operation: (Ptypes.path,
                        String('One of the 4 arithmetic operations.',
                                enum=['add', 'sub', 'mul', 'div'])),
            first: (Ptypes.path,
                    Float('The first operand.')),
            second: (Ptypes.path,
                     Float('The second operand.'))) -> [
            (200, 'Ok', Float),
            (400, 'Wrong number format or invalid operation'),
            (422, 'NaN')]:
        '''Any of the four arithmetic operation on two numbers.'''
        log.info('Performing {} on {} and {}'.format(operation, first, second))
        try:
            first = float(first)
            second = float(second)
        except ValueError:
            Respond(400)
        if operation == 'add':
            Respond(200, first + second)
        elif operation == 'sub':
            Respond(200, first - second)
        elif operation == 'mul':
            Respond(200, first * second)
        elif operation == 'div':
            if second == 0:
                Respond(422)
            Respond(200, first / second)
        else:
            Respond(400)