nodes: 0, module; 1, function_definition; 2, function_name:_select_mgmt_networks; 3, parameters; 4, block; 5, identifier:self; 6, identifier:conf; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, return_statement; 13, comment:"""
          Select management networks. If no management network is found, it will
          mark the first network found by sorted the network lists. Also adding
          default DNS domain, if none is set.
  
          Args:
              conf(spec): spec
  
          """; 14, assignment; 15, assignment; 16, comparison_operator:len(mgmts) == 0; 17, block; 18, identifier:mgmt_name; 19, identifier:mgmts; 20, block; 21, identifier:mgmts; 22, identifier:nets; 23, subscript; 24, identifier:mgmts; 25, call; 26, call; 27, integer:0; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, if_statement; 33, identifier:conf; 34, string; 35, identifier:sorted; 36, argument_list; 37, identifier:len; 38, argument_list; 39, assignment; 40, call; 41, assignment; 42, call; 43, comparison_operator:nets[mgmt_name].get('dns_domain_name', None) is None; 44, block; 45, string_content:nets; 46, list_comprehension; 47, identifier:mgmts; 48, identifier:mgmt_name; 49, subscript; 50, attribute; 51, argument_list; 52, subscript; 53, True; 54, attribute; 55, argument_list; 56, call; 57, None; 58, expression_statement; 59, identifier:name; 60, for_in_clause; 61, if_clause; 62, call; 63, integer:0; 64, identifier:LOGGER; 65, identifier:debug; 66, string; 67, identifier:mgmt_name; 68, subscript; 69, string; 70, identifier:mgmts; 71, identifier:append; 72, identifier:mgmt_name; 73, attribute; 74, argument_list; 75, assignment; 76, pattern_list; 77, call; 78, comparison_operator:net.get('management') is True; 79, identifier:sorted; 80, argument_list; 81, string_content:No management network configured, selecting network %s; 82, identifier:nets; 83, identifier:mgmt_name; 84, string_content:management; 85, subscript; 86, identifier:get; 87, string; 88, None; 89, subscript; 90, string; 91, identifier:name; 92, identifier:net; 93, attribute; 94, argument_list; 95, call; 96, True; 97, parenthesized_expression; 98, identifier:nets; 99, identifier:mgmt_name; 100, string_content:dns_domain_name; 101, subscript; 102, string; 103, string_content:lago.local; 104, identifier:nets; 105, identifier:iteritems; 106, attribute; 107, argument_list; 108, call; 109, identifier:nets; 110, identifier:mgmt_name; 111, string_content:dns_domain_name; 112, identifier:net; 113, identifier:get; 114, string; 115, attribute; 116, argument_list; 117, string_content:management; 118, identifier:nets; 119, identifier:keys
code: def _select_mgmt_networks(self, conf):
          """
          Select management networks. If no management network is found, it will
          mark the first network found by sorted the network lists. Also adding
          default DNS domain, if none is set.
  
          Args:
              conf(spec): spec
  
          """
  
          nets = conf['nets']
          mgmts = sorted(
              [
                  name for name, net in nets.iteritems()
                  if net.get('management') is True
              ]
          )
  
          if len(mgmts) == 0:
              mgmt_name = sorted((nets.keys()))[0]
              LOGGER.debug(
                  'No management network configured, selecting network %s',
                  mgmt_name
              )
              nets[mgmt_name]['management'] = True
              mgmts.append(mgmt_name)
  
          for mgmt_name in mgmts:
              if nets[mgmt_name].get('dns_domain_name', None) is None:
                  nets[mgmt_name]['dns_domain_name'] = 'lago.local'
  
          return mgmts