docs: def watch_profile(self):
          """Analyzes queries from a given log file"""
          profile_parser = ProfileParser()
          databases = self._get_requested_databases()
          connection = pymongo.MongoClient(self._db_uri,
                                           document_class=OrderedDict,
                                           read_preference=pymongo.ReadPreference.PRIMARY_PREFERRED)
          enabled_profile = False
  
          if databases == []:
              try:
                  databases = connection.database_names()
              except:
                  message = "Error: Could not list databases on server. Please " \
                            +         "check the auth components of your URI.\n"
                  sys.stderr.write(message)
                  databases = []
  
              for ignore_db in IGNORE_DBS:
                  if ignore_db in databases:
                      databases.remove(ignore_db)
  
          if len(databases) != 1:
              message = "Error: Please use namespaces (-n) to specify a single " \
                        +         "database for profile watching.\n"
              sys.stderr.write(message)
              return 1
  
          database = databases[0]
          db = connection[database]
  
          initial_profile_level = db.profiling_level()
  
          if initial_profile_level is pymongo.OFF:
              message = "Profile level currently 0. Dex is setting profile " \
                        +         "level 1. To run --watch at profile level 2, " \
                        +         "enable profile level 2 before running Dex.\n"
              sys.stderr.write(message)
              db.set_profiling_level(DEFAULT_PROFILE_LEVEL)
  
          output_time = time.time() + WATCH_DISPLAY_REFRESH_SECONDS
          try:
              for profile_entry in self._tail_profile(db, WATCH_INTERVAL_SECONDS):
                  self._process_query(profile_entry,
                                      profile_parser)
                  if time.time() >= output_time:
                      self._output_aggregated_report(sys.stderr)
                      output_time = time.time() + WATCH_DISPLAY_REFRESH_SECONDS
          except KeyboardInterrupt:
              sys.stderr.write("Interrupt received\n")
          finally:
              self._output_aggregated_report(sys.stdout)
              if initial_profile_level is pymongo.OFF:
                  message = "Dex is resetting profile level to initial value " \
                            +         "of 0. You may wish to drop the system.profile " \
                            +         "collection.\n"
                  sys.stderr.write(message)
                  db.set_profiling_level(initial_profile_level)
  
          return 0