code: def install(cls, handler, fmt=None, use_chroot=True, style=DEFAULT_FORMAT_STYLE):
          
          if fmt:
              parser = FormatStringParser(style=style)
              if not parser.contains_field(fmt, 'hostname'):
                  return
          handler.addFilter(cls(use_chroot))
docs: Install the :class:`HostNameFilter` on a log handler (only if needed).
  
          :param fmt: The log format string to check for ``%(hostname)``.
          :param style: One of the characters ``%``, ``{`` or ``$`` (defaults to
                        :data:`DEFAULT_FORMAT_STYLE`).
          :param handler: The logging handler on which to install the filter.
          :param use_chroot: Refer to :func:`find_hostname()`.
  
          If `fmt` is given the filter will only be installed if `fmt` uses the
          ``hostname`` field. If `fmt` is not given the filter is installed
          unconditionally.