code: def prepare_dir(directory, delete=True):
      
      if os.path.exists(directory):
          if delete:
              assert directory != thisdir, 'Trying to delete docs! Specify other output dir!'
              print 'Deleting %s' % directory
              shutil.rmtree(directory)
              print 'Creating %s' % directory
              os.mkdir(directory)
      else:
          print 'Creating %s' % directory
          os.mkdir(directory)
docs: Create apidoc dir, delete contents if delete is True.
  
      :param directory: the apidoc directory. you can use relative paths here
      :type directory: str
      :param delete: if True, deletes the contents of apidoc. This acts like an override switch.
      :type delete: bool
      :returns: None
      :rtype: None
      :raises: None