docs: def extract_docstring(filename):
      """ Extract a module-level docstring, if any
      """
      lines = file(filename).readlines()
      start_row = 0
      if lines[0].startswith('#!'):
          lines.pop(0)
          start_row = 1
  
      docstring = ''
      first_par = ''
      tokens = tokenize.generate_tokens(iter(lines).next)
      for tok_type, tok_content, _, (erow, _), _ in tokens:
          tok_type = token.tok_name[tok_type]
          if tok_type in ('NEWLINE', 'COMMENT', 'NL', 'INDENT', 'DEDENT'):
              continue
          elif tok_type == 'STRING':
              docstring = eval(tok_content)
              # If the docstring is formatted with several paragraphs, extract
              # the first one:
              paragraphs = '\n'.join(line.rstrip()
                                for line in docstring.split('\n')).split('\n\n')
              if len(paragraphs) > 0:
                  first_par = paragraphs[0]
          break
      end_row = erow + 1 + start_row
      if lines and lines[end_row - 2] == 'print(__doc__)\n':
          end_row += 1
      return docstring, first_par, end_row