Create the specified path, making all intermediate-level directories
    needed to contain the leaf directory.  Ignore any error that would
    occur if the leaf directory already exists.

    @note: all the intermediate-level directories are created with the
        default mode is 0777 (octal).

    @param path: the path to create.

    @raise OSError: an error that would occur if the path cannot be
        created.

def make_directory_if_not_exists(path):
    """
    Create the specified path, making all intermediate-level directories
    needed to contain the leaf directory.  Ignore any error that would
    occur if the leaf directory already exists.

    @note: all the intermediate-level directories are created with the
        default mode is 0777 (octal).

    @param path: the path to create.

    @raise OSError: an error that would occur if the path cannot be
        created.
    """
    try:
        os.makedirs(path)
    except OSError, error: # Ignore if the directory has been already created.
        if error.errno <> errno.EEXIST:
            raise error