code: def find_hostname(use_chroot=True):
      
      for chroot_file in CHROOT_FILES:
          try:
              with open(chroot_file) as handle:
                  first_line = next(handle)
                  name = first_line.strip()
                  if name:
                      return name
          except Exception:
              pass
      return socket.gethostname()
docs: Find the host name to include in log messages.
  
      :param use_chroot: Use the name of the chroot when inside a chroot?
                         (boolean, defaults to :data:`True`)
      :returns: A suitable host name (a string).
  
      Looks for :data:`CHROOT_FILES` that have a nonempty first line (taken to be
      the chroot name). If none are found then :func:`socket.gethostname()` is
      used as a fall back.