docs: def add_attributes(attrs,**kwargs):
      """
      Add a list of generic attributes, which can then be used in creating
      a resource attribute, and put into a type.
  
      .. code-block:: python
  
          (Attr){
              id = 1020
              name = "Test Attr"
              dimen = "very big"
          }
  
      """
  
      #Check to see if any of the attributs being added are already there.
      #If they are there already, don't add a new one. If an attribute
      #with the same name is there already but with a different dimension,
      #add a new attribute.
  
      # All existing attributes
      all_attrs = db.DBSession.query(Attr).all()
      attr_dict = {}
      for attr in all_attrs:
          attr_dict[(attr.name.lower(), attr.dimension_id)] = JSONObject(attr)
  
      attrs_to_add = []
      existing_attrs = []
      for potential_new_attr in attrs:
          if potential_new_attr is not None:
              # If the attrinute is None we cannot manage it
              log.debug("Adding attribute: %s", potential_new_attr)
  
              if attr_dict.get((potential_new_attr.name.lower(), potential_new_attr.dimension_id)) is None:
                  attrs_to_add.append(JSONObject(potential_new_attr))
              else:
                  existing_attrs.append(attr_dict.get((potential_new_attr.name.lower(), potential_new_attr.dimension_id)))
  
      new_attrs = []
      for attr in attrs_to_add:
          attr_i = Attr()
          attr_i.name = attr.name
          attr_i.dimension_id = attr.dimension_id
          attr_i.description = attr.description
          db.DBSession.add(attr_i)
          new_attrs.append(attr_i)
  
      db.DBSession.flush()
      
  
      new_attrs = new_attrs + existing_attrs
  
      return [JSONObject(a) for a in new_attrs]