code: def tidy(self):
          
          try:
              self.tags.sort(lambda x, y: cmp(len(x), len(y)))
          except:
              pass
  
          try:
              for t in self.tasks:
                  t.tidy()
          except:
              pass
  
          try:
              for p in self.projects:
                  p.tidy()
          except:
              pass
  
          # REMOVE BLANK LINES
          if self.content:
              if self.parent:
                  self.content = ("\n").join(self.to_string(
                      indentLevel=0).split("\n")[1:])
              else:
                  regex = re.compile(r'\s*?\n\s*?\n')
                  while "\n\n" in self.content:
                      self.content = regex.sub("\n", self.content)
  
          if not self.parent:
              self.content = self.to_string(
                  indentLevel=0, title=False)
          return None
docs: *Tidy this taskpapaer object so that sub-objects appear in this order: title, tags, notes, tasks, projects*
  
          **Return:**
              - ``None``
  
          **Usage:**
  
             When a taskpaper document is opened it is tidied by default. To tidy the document object (or project or task) use the command:
  
              .. code-block:: python
  
                  doc.tidy()