nodes: 0, module; 1, function_definition; 2, function_name:export; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Export a set of organizations.
  
          Method to export organizations from the registry. Organizations schema
          will follow Sorting Hat JSON format.
  
          :returns: a JSON formatted str
          """; 13, assignment; 14, assignment; 15, identifier:org; 16, identifier:orgs; 17, block; 18, assignment; 19, call; 20, identifier:organizations; 21, dictionary; 22, identifier:orgs; 23, call; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, identifier:obj; 28, dictionary; 29, attribute; 30, argument_list; 31, attribute; 32, argument_list; 33, assignment; 34, call; 35, assignment; 36, pair; 37, pair; 38, pair; 39, pair; 40, identifier:json; 41, identifier:dumps; 42, identifier:obj; 43, keyword_argument; 44, keyword_argument; 45, keyword_argument; 46, keyword_argument; 47, identifier:api; 48, identifier:registry; 49, attribute; 50, identifier:domains; 51, list_comprehension; 52, attribute; 53, argument_list; 54, subscript; 55, identifier:domains; 56, string; 57, call; 58, string; 59, list; 60, string; 61, identifier:organizations; 62, string; 63, dictionary; 64, identifier:default; 65, attribute; 66, identifier:indent; 67, integer:4; 68, identifier:separators; 69, tuple; 70, identifier:sort_keys; 71, True; 72, identifier:self; 73, identifier:db; 74, dictionary; 75, for_in_clause; 76, identifier:domains; 77, identifier:sort; 78, keyword_argument; 79, identifier:organizations; 80, attribute; 81, string_content:time; 82, identifier:str; 83, argument_list; 84, string_content:blacklist; 85, string_content:organizations; 86, string_content:uidentities; 87, identifier:self; 88, identifier:_json_encoder; 89, string; 90, string; 91, pair; 92, pair; 93, identifier:dom; 94, attribute; 95, identifier:key; 96, lambda; 97, identifier:org; 98, identifier:name; 99, call; 100, string_content:,; 101, string_content::; 102, string; 103, attribute; 104, string; 105, attribute; 106, identifier:org; 107, identifier:domains; 108, lambda_parameters; 109, subscript; 110, attribute; 111, argument_list; 112, string_content:domain; 113, identifier:dom; 114, identifier:domain; 115, string_content:is_top; 116, identifier:dom; 117, identifier:is_top_domain; 118, identifier:x; 119, identifier:x; 120, string; 121, attribute; 122, identifier:now; 123, string_content:domain; 124, identifier:datetime; 125, identifier:datetime
code: def export(self):
          """Export a set of organizations.
  
          Method to export organizations from the registry. Organizations schema
          will follow Sorting Hat JSON format.
  
          :returns: a JSON formatted str
          """
          organizations = {}
  
          orgs = api.registry(self.db)
  
          for org in orgs:
              domains = [{'domain': dom.domain,
                          'is_top': dom.is_top_domain}
                         for dom in org.domains]
              domains.sort(key=lambda x: x['domain'])
  
              organizations[org.name] = domains
  
          obj = {'time': str(datetime.datetime.now()),
                 'blacklist': [],
                 'organizations': organizations,
                 'uidentities': {}}
  
          return json.dumps(obj, default=self._json_encoder,
                            indent=4, separators=(',', ': '),
                            sort_keys=True)