#NEWLINE# def _from_native_dict( self , condition_dict ) : #NEWLINE# #INDENT# '\n        {"bucket": "name-of-bucket"}\n        ' #NEWLINE# from numbers import Number #NEWLINE# from drf_to_s3.models import PolicyCondition #NEWLINE# if ( len ( condition_dict ) > 1 ) : #NEWLINE# #INDENT# raise ValidationError ( _ ( 'Too many values in condition dictionary: %(condition)s' ) , params = { #NEWLINE# #INDENT# 'condition' : condition_dict , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# ( element_name , value ) = condition_dict . popitem ( ) #NEWLINE# if ( ( not isinstance ( element_name , basestring ) ) and ( not isinstance ( value , Number ) ) ) : #NEWLINE# #INDENT# raise ValidationError ( _ ( 'Values in condition dictionaries should be numbers or strings' ) ) #NEWLINE# #UNINDENT# return PolicyCondition ( operator = None , element_name = element_name , value = value , value_range = None )