code: def unicode_http_header(value):
      r
      if six.PY3:  # pragma: no cover
          # email.header.decode_header expects strings, not bytes. Your input data may be in bytes.
          # Since these bytes are almost always ASCII, calling `.decode()` on it without specifying
          # a charset should work fine.
          if isinstance(value, six.binary_type):
              value = value.decode()
      return u''.join([six.text_type(s, e or 'iso-8859-1') if not isinstance(s, six.text_type) else s
          for s, e in decode_header(value)])
docs: r"""
      Convert an ASCII HTTP header string into a unicode string with the
      appropriate encoding applied. Expects headers to be RFC 2047 compliant.
  
      >>> unicode_http_header('=?iso-8859-1?q?p=F6stal?=') == u'p\xf6stal'
      True
      >>> unicode_http_header(b'=?iso-8859-1?q?p=F6stal?=') == u'p\xf6stal'
      True
      >>> unicode_http_header('p\xf6stal') == u'p\xf6stal'
      True