#NEWLINE# def get_attribute( self , key = None , category = None , value = None , strvalue = None , obj = None , attrtype = None ) : #NEWLINE# #INDENT# '\n        Return Attribute objects by key, by category, by value, by\n        strvalue, by object (it is stored on) or with a combination of\n        those criteria.\n\n        Attrs:\n            key (str, optional): The attribute\'s key to search for\n            category (str, optional): The category of the attribute(s)\n                to search for.\n            value (str, optional): The attribute value to search for.\n                Note that this is not a very efficient operation since it\n                will query for a pickled entity. Mutually exclusive to\n                `strvalue`.\n            strvalue (str, optional): The str-value to search for.\n                Most Attributes will not have strvalue set. This is\n                mutually exclusive to the `value` keyword and will take\n                precedence if given.\n            obj (Object, optional): On which object the Attribute to\n                search for is.\n            attrype (str, optional): An attribute-type to search for.\n                By default this is either `None` (normal Attributes) or\n                `"nick"`.\n\n        Returns:\n            attributes (list): The matching Attributes.\n\n        ' #NEWLINE# query = [ ( 'attribute__db_attrtype' , attrtype ) ] #NEWLINE# if obj : #NEWLINE# #INDENT# query . append ( ( ( '%s__id' % self . model . __name__ . lower ( ) ) , obj . id ) ) #NEWLINE# #UNINDENT# if key : #NEWLINE# #INDENT# query . append ( ( 'attribute__db_key' , key ) ) #NEWLINE# #UNINDENT# if category : #NEWLINE# #INDENT# query . append ( ( 'attribute__db_category' , category ) ) #NEWLINE# #UNINDENT# if value : #NEWLINE# #INDENT# query . append ( ( 'attribute__db_strvalue' , strvalue ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if value : #NEWLINE# #INDENT# query . append ( ( 'attribute__db_value' , value ) ) #NEWLINE# #UNINDENT# #UNINDENT# return [ th . attribute for th in self . model . db_attributes . through . objects . filter ( ** dict ( query ) ) ]