<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def confirm_register_form_factory(Form, app):
 """Return confirmation for extended registration form."""

    if app.config.get('RECAPTCHA_PUBLIC_KEY') and \
            app.config.get('RECAPTCHA_PRIVATE_KEY'):
        class ConfirmRegisterForm(Form):
            recaptcha = FormField(RegistrationFormRecaptcha, separator='.')

        return ConfirmRegisterForm

    return Form