<s> """<STR_LIT>""" <EOL> from rest_framework import serializers <EOL> class FieldSelectorSerializer ( serializers . ModelSerializer ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> fields = kwargs . pop ( '<STR_LIT>' , None ) <EOL> super ( FieldSelectorSerializer , self ) . __init__ ( * args , ** kwargs ) <EOL> if fields : <EOL> allowed = set ( fields ) <EOL> existing = set ( self . fields . keys ( ) ) <EOL> for field in existing - allowed : <EOL> self . fields . pop ( field ) </s>
