def enroll(self):
        """Enrollment function"""
        self.verify_integrity()

        if session.get('u2f_enroll_authorized', False):
            if request.method == 'GET':
                return jsonify(self.get_enroll()), 200

            elif request.method == 'POST':
                response = self.verify_enroll(request.json)

                if response['status'] == 'ok':
                    return jsonify(response), 201
                else:
                    return jsonify(response), 400

        return jsonify({'status': 'failed', 'error': 'Unauthorized!'}), 401
def enroll ( self ) : self . verify_integrity ( ) if session . get ( 'u2f_enroll_authorized' , False ) : if request . method == 'GET' : return jsonify ( self . get_enroll ( ) ) , 200 elif request . method == 'POST' : response = self . verify_enroll ( request . json ) if response [ 'status' ] == 'ok' : return jsonify ( response ) , 201 else : return jsonify ( response ) , 400 return jsonify ( { 'status' : 'failed' , 'error' : 'Unauthorized!' } ) , 401
Enrollment function