nodes: 0, module; 1, function_definition; 2, function_name:tag_create; 3, parameters; 4, block; 5, identifier:self; 6, identifier:label; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, comment:# filter input into lists of ids; 15, expression_statement; 16, for_statement; 17, comment:# filter entities into id lists too; 18, expression_statement; 19, for_statement; 20, comment:# finally, omit all id lists that are empty; 21, expression_statement; 22, expression_statement; 23, if_statement; 24, expression_statement; 25, return_statement; 26, identifier:instances; 27, None; 28, identifier:domains; 29, None; 30, identifier:nodebalancers; 31, None; 32, identifier:volumes; 33, None; 34, identifier:entities; 35, list; 36, comment:"""
          Creates a new Tag and optionally applies it to the given entities.
  
          :param label: The label for the new Tag
          :type label: str
          :param entities: A list of objects to apply this Tag to upon creation.
                           May only be taggable types (Linode Instances, Domains,
                           NodeBalancers, or Volumes).  These are applied *in addition
                           to* any IDs specified with ``instances``, ``domains``,
                           ``nodebalancers``, or ``volumes``, and is a convenience
                           for sending multiple entity types without sorting them
                           yourself.
          :type entities: list of Instance, Domain, NodeBalancer, and/or Volume
          :param instances: A list of Linode Instances to apply this Tag to upon
                          creation
          :type instances: list of Instance or list of int
          :param domains: A list of Domains to apply this Tag to upon
                          creation
          :type domains: list of Domain or list of int
          :param nodebalancers: A list of NodeBalancers to apply this Tag to upon
                          creation
          :type nodebalancers: list of NodeBalancer or list of int
          :param volumes: A list of Volumes to apply this Tag to upon
                          creation
          :type volumes: list of Volumes or list of int
  
          :returns: The new Tag
          :rtype: Tag
          """; 37, assignment; 38, assignment; 39, pattern_list; 40, identifier:sorter; 41, comment:# if we got something, we need to find its ID; 42, block; 43, assignment; 44, identifier:e; 45, identifier:entities; 46, block; 47, assignment; 48, assignment; 49, not_operator; 50, block; 51, assignment; 52, identifier:t; 53, pattern_list; 54, expression_list; 55, identifier:sorter; 56, call; 57, identifier:id_list; 58, identifier:input_list; 59, if_statement; 60, identifier:type_map; 61, dictionary; 62, if_statement; 63, identifier:params; 64, dictionary; 65, identifier:result; 66, call; 67, comparison_operator:'label' in result; 68, raise_statement; 69, identifier:t; 70, call; 71, identifier:linode_ids; 72, identifier:nodebalancer_ids; 73, identifier:domain_ids; 74, identifier:volume_ids; 75, list; 76, list; 77, list; 78, list; 79, identifier:zip; 80, argument_list; 81, comparison_operator:input_list is not None; 82, block; 83, pair; 84, pair; 85, pair; 86, pair; 87, comparison_operator:type(e) in type_map; 88, block; 89, else_clause; 90, pair; 91, pair; 92, pair; 93, pair; 94, pair; 95, attribute; 96, argument_list; 97, string; 98, identifier:result; 99, call; 100, identifier:Tag; 101, argument_list; 102, tuple; 103, tuple; 104, identifier:input_list; 105, None; 106, for_statement; 107, identifier:Instance; 108, identifier:linode_ids; 109, identifier:NodeBalancer; 110, identifier:nodebalancer_ids; 111, identifier:Domain; 112, identifier:domain_ids; 113, identifier:Volume; 114, identifier:volume_ids; 115, call; 116, identifier:type_map; 117, expression_statement; 118, block; 119, string; 120, identifier:label; 121, string; 122, boolean_operator; 123, string; 124, boolean_operator; 125, string; 126, boolean_operator; 127, string; 128, boolean_operator; 129, identifier:self; 130, identifier:post; 131, string; 132, keyword_argument; 133, string_content:label; 134, identifier:UnexpectedResponseError; 135, argument_list; 136, identifier:self; 137, subscript; 138, identifier:result; 139, identifier:linode_ids; 140, identifier:nodebalancer_ids; 141, identifier:domain_ids; 142, identifier:volume_ids; 143, identifier:instances; 144, identifier:nodebalancers; 145, identifier:domains; 146, identifier:volumes; 147, identifier:cur; 148, identifier:input_list; 149, block; 150, identifier:type; 151, argument_list; 152, call; 153, raise_statement; 154, string_content:label; 155, string_content:linodes; 156, identifier:linode_ids; 157, None; 158, string_content:nodebalancers; 159, identifier:nodebalancer_ids; 160, None; 161, string_content:domains; 162, identifier:domain_ids; 163, None; 164, string_content:volumes; 165, identifier:volume_ids; 166, None; 167, string_content:/tags; 168, identifier:data; 169, identifier:params; 170, string; 171, keyword_argument; 172, identifier:result; 173, string; 174, if_statement; 175, identifier:e; 176, attribute; 177, argument_list; 178, call; 179, string_content:Unexpected response when creating Tag!; 180, identifier:json; 181, identifier:result; 182, string_content:label; 183, call; 184, block; 185, else_clause; 186, subscript; 187, identifier:append; 188, attribute; 189, identifier:ValueError; 190, argument_list; 191, identifier:isinstance; 192, argument_list; 193, expression_statement; 194, block; 195, identifier:type_map; 196, call; 197, identifier:e; 198, identifier:id; 199, call; 200, identifier:cur; 201, identifier:int; 202, call; 203, expression_statement; 204, identifier:type; 205, argument_list; 206, attribute; 207, argument_list; 208, attribute; 209, argument_list; 210, call; 211, identifier:e; 212, string; 213, identifier:format; 214, call; 215, identifier:id_list; 216, identifier:append; 217, identifier:cur; 218, attribute; 219, argument_list; 220, string_content:Unsupported entity type {}; 221, identifier:type; 222, argument_list; 223, identifier:id_list; 224, identifier:append; 225, attribute; 226, identifier:e; 227, identifier:cur; 228, identifier:id
code: def tag_create(self, label, instances=None, domains=None, nodebalancers=None,
                     volumes=None, entities=[]):
          """
          Creates a new Tag and optionally applies it to the given entities.
  
          :param label: The label for the new Tag
          :type label: str
          :param entities: A list of objects to apply this Tag to upon creation.
                           May only be taggable types (Linode Instances, Domains,
                           NodeBalancers, or Volumes).  These are applied *in addition
                           to* any IDs specified with ``instances``, ``domains``,
                           ``nodebalancers``, or ``volumes``, and is a convenience
                           for sending multiple entity types without sorting them
                           yourself.
          :type entities: list of Instance, Domain, NodeBalancer, and/or Volume
          :param instances: A list of Linode Instances to apply this Tag to upon
                          creation
          :type instances: list of Instance or list of int
          :param domains: A list of Domains to apply this Tag to upon
                          creation
          :type domains: list of Domain or list of int
          :param nodebalancers: A list of NodeBalancers to apply this Tag to upon
                          creation
          :type nodebalancers: list of NodeBalancer or list of int
          :param volumes: A list of Volumes to apply this Tag to upon
                          creation
          :type volumes: list of Volumes or list of int
  
          :returns: The new Tag
          :rtype: Tag
          """
          linode_ids, nodebalancer_ids, domain_ids, volume_ids = [], [], [], []
  
          # filter input into lists of ids
          sorter = zip((linode_ids, nodebalancer_ids, domain_ids, volume_ids),
                       (instances, nodebalancers, domains, volumes))
  
          for id_list, input_list in sorter:
              # if we got something, we need to find its ID
              if input_list is not None:
                  for cur in input_list:
                      if isinstance(cur, int):
                          id_list.append(cur)
                      else:
                          id_list.append(cur.id)
  
          # filter entities into id lists too
          type_map = {
              Instance: linode_ids,
              NodeBalancer: nodebalancer_ids,
              Domain: domain_ids,
              Volume: volume_ids,
          }
  
          for e in entities:
              if type(e) in type_map:
                  type_map[type(e)].append(e.id)
              else:
                  raise ValueError('Unsupported entity type {}'.format(type(e)))
  
          # finally, omit all id lists that are empty
          params = {
              'label': label,
              'linodes': linode_ids or None,
              'nodebalancers': nodebalancer_ids or None,
              'domains': domain_ids or None,
              'volumes': volume_ids or None,
          }
  
          result = self.post('/tags', data=params)
  
          if not 'label' in result:
              raise UnexpectedResponseError('Unexpected response when creating Tag!', json=result)
  
          t = Tag(self, result['label'], result)
          return t