<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_payment(state_engine, state_op_type, nameop, fee_block_id, token_address, burn_address, name_fee, block_id):
 """ Verify that the right payment was made, in the right cryptocurrency units. Does not check any accounts or modify the nameop in any way; it only checks that the name was paid for by the transaction. NOTE: if state_op_type is NAME_REGISTRATION, you will need to have called state_create_put_preorder() before calling this method! Returns {'status': False} if not """

    assert state_op_type in ['NAME_REGISTRATION', 'NAME_RENEWAL'], 'Invalid op type {}'.format(state_op_type)

    assert name_fee is not None
    assert isinstance(name_fee, (int,long))

    name = nameop['name']
    namespace_id = get_namespace_from_name(name)
    namespace = state_engine.get_namespace( namespace_id )

    res = None
    log.debug('{} is a version-0x{} namespace'.format(namespace['namespace_id'], namespace['version']))

    # check name fee, depending on which version.
    if namespace['version'] == NAMESPACE_VERSION_PAY_TO_BURN:
        res = check_payment_v1(state_engine, state_op_type, nameop, fee_block_id, token_address, burn_address, name_fee, block_id)

    elif namespace['version'] == NAMESPACE_VERSION_PAY_TO_CREATOR:
        res = check_payment_v2(state_engine, state_op_type, nameop, fee_block_id, token_address, burn_address, name_fee, block_id)
        
    elif namespace['version'] == NAMESPACE_VERSION_PAY_WITH_STACKS:
        res = check_payment_v3(state_engine, state_op_type, nameop, fee_block_id, token_address, burn_address, name_fee, block_id)

    else:
        # unrecognized namespace rules
        log.warning("Namespace {} has version bits 0x{:x}, which has unknown registration rules".format(namespace['namespace_id'], namespace['version']))
        return {'status': False}

    if not res['status']:
        return res

    tokens_paid = res['tokens_paid']
    token_units = res['token_units']

    return {'status': True, 'tokens_paid': tokens_paid, 'token_units': token_units}