code: def __parse_blacklist(self, json):
          
          try:
              for entry in json['blacklist']:
                  if not entry:
                      msg = "invalid json format. Blacklist entries cannot be null or empty"
                      raise InvalidFormatError(cause=msg)
  
                  excluded = self.__encode(entry)
  
                  bl = self._blacklist.get(excluded, None)
  
                  if not bl:
                      bl = MatchingBlacklist(excluded=excluded)
                      self._blacklist[excluded] = bl
          except KeyError as e:
              msg = "invalid json format. Attribute %s not found" % e.args
              raise InvalidFormatError(cause=msg)
docs: Parse blacklist entries using Sorting Hat format.
  
          The Sorting Hat blacklist format is a JSON stream that
          stores a list of blacklisted entries.
  
          Next, there is an example of a valid stream:
  
          {
              "blacklist": [
                  "John Doe",
                  "John Smith",
                  "root@example.com"
              ]
          }
  
          :param stream: stream to parse
  
          :raises InvalidFormatError: raised when the format of the stream is
              not valid.