code: def unwrap(text):
      
  
      lines = text.split('\n')
  
      result = _internal.unwrap(lines, _patterns.MAX_WRAP_LINES,
                      _patterns.MIN_HEADER_LINES,_patterns.MIN_QUOTED_LINES)
      if result:
          typ, top_range, hdrs, main_range, bottom_range, needs_unindent = result
  
          text_top = lines[slice(*top_range)] if top_range else ''
          text = lines[slice(*main_range)] if main_range else ''
          text_bottom = lines[slice(*bottom_range)] if bottom_range else ''
  
          if needs_unindent:
              text = _internal.unindent_lines(text)
  
          result = {
              'type': typ,
          }
  
          text = '\n'.join(text).strip()
          text_top = '\n'.join(text_top).strip()
          text_bottom = '\n'.join(text_bottom).strip()
  
          if text:
              result['text'] = text
          if text_top:
              result['text_top'] = text_top
          if text_bottom:
              result['text_bottom'] = text_bottom
  
          if hdrs:
              result.update(hdrs)
  
          return result
docs: If the passed text is the text body of a forwarded message, a reply, or
      contains quoted text, a dictionary with the following keys is returned:
  
      - type: "reply", "forward" or "quote"
      - text_top: Text at the top of the passed message (if found)
      - text_bottom: Text at the bottom of the passed message (if found)
      - from / to / subject / cc / bcc / reply-to: Corresponding header of the
        forwarded message, if it exists. (if found)
      - text: Unindented text of the wrapped message (if found)
  
      Otherwise, this function returns None.