nodes: 0, module; 1, function_definition; 2, function_name:__parse; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stream; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:"""Parse Sorting Hat stream"""; 14, not_operator; 15, block; 16, assignment; 17, call; 18, call; 19, call; 20, identifier:stream; 21, raise_statement; 22, identifier:json; 23, call; 24, attribute; 25, argument_list; 26, attribute; 27, argument_list; 28, attribute; 29, argument_list; 30, call; 31, attribute; 32, argument_list; 33, identifier:self; 34, identifier:__parse_organizations; 35, identifier:json; 36, identifier:self; 37, identifier:__parse_identities; 38, identifier:json; 39, identifier:self; 40, identifier:__parse_blacklist; 41, identifier:json; 42, identifier:InvalidFormatError; 43, argument_list; 44, identifier:self; 45, identifier:__load_json; 46, identifier:stream; 47, keyword_argument; 48, identifier:cause; 49, string:"stream cannot be empty or None"
code: def __parse(self, stream):
          """Parse Sorting Hat stream"""
  
          if not stream:
              raise InvalidFormatError(cause="stream cannot be empty or None")
  
          json = self.__load_json(stream)
  
          self.__parse_organizations(json)
          self.__parse_identities(json)
          self.__parse_blacklist(json)