def ensure_dir(d):
if not os.path.exists(d):<EOL><INDENT>try:<EOL><INDENT>os.makedirs(d)<EOL><DEDENT>except OSError as oe:<EOL><INDENT>if os.errno == errno.ENOENT:<EOL><INDENT>msg = twdd("""<STR_LIT>""")<EOL>return msg.format(d)<EOL><DEDENT>else:<EOL><INDENT>msg = twdd("""<STR_LIT>""")<EOL>return msg.format(d, oe.strerror)<EOL><DEDENT><DEDENT><DEDENT>
Check to make sure the supplied directory path does not exist, if so, create it. The
method catches OSError exceptions and returns a descriptive message instead of
re-raising the error.

:type d: str
:param d: It is the full path to a directory.

:return: Does not return anything, but creates a directory path if it doesn't exist
         already.