code: def decode_header_part(header):
      
      if not header:
          return six.text_type()
  
      output = six.text_type()
  
      try:
          for d, c in decode_header(header):
              c = c if c else 'utf-8'
              output += ported_string(d, c, 'ignore')
  
      # Header parsing failed, when header has charset Shift_JIS
      except (HeaderParseError, UnicodeError):
          log.error("Failed decoding header part: {}".format(header))
          output += header
  
      return output
docs: Given an raw header returns an decoded header
  
      Args:
          header (string): header to decode
  
      Returns:
          str (Python 3) or unicode (Python 2)