def mkdirs(path):
    """
    Ensures the path is a directory or makes it if not. Errors if the path
    exists but is a file or on permissions failure.

    :param path: path to create
    """
    if not os.path.isdir(path):
        try:
            os.makedirs(path)
        except __HOLE__ as err:
            if err.errno != errno.EEXIST or not os.path.isdir(path):
                raise
dataset/ETHPy150Open openstack/swift/swift/common/utils.py/mkdirs