| Conditions | 2 | 
| Total Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | from rest_framework import serializers  | 
            ||
| 26 | def validate_state(self, value):  | 
            ||
| 27 | strategy = load_strategy(self.context['request'])  | 
            ||
| 28 |         redirect_uri = strategy.session_get('redirect_uri') | 
            ||
| 29 | |||
| 30 | backend_name = self.context['view'].kwargs['provider']  | 
            ||
| 31 | backend = load_backend(  | 
            ||
| 32 | strategy, backend_name, redirect_uri=redirect_uri  | 
            ||
| 33 | )  | 
            ||
| 34 | |||
| 35 | try:  | 
            ||
| 36 | backend.validate_state()  | 
            ||
| 37 | except exceptions.AuthException:  | 
            ||
| 38 |             raise serializers.ValidationError('State could not be verified.') | 
            ||
| 39 | 
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.