def prepare_dir(directory, delete=True):
if os.path.exists(directory):<EOL><INDENT>if delete:<EOL><INDENT>assert directory != thisdir, '<STR_LIT>'<EOL>print('<STR_LIT>' % directory)<EOL>shutil.rmtree(directory)<EOL>print('<STR_LIT>' % directory)<EOL>os.mkdir(directory)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>print('<STR_LIT>' % directory)<EOL>os.mkdir(directory)<EOL><DEDENT>
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