def ensure_dir_exists(verify_dir):
    """Ensure directory exists. Create if necessary."""
    if not os.path.exists(verify_dir):
        # Doesn't exist create dir
        os.makedirs(verify_dir)
    else:
        # Exists
        if not os.path.isdir(verify_dir):
            # Not a dir, raise an exception
            raise ValueError("{} is not a directory".format(verify_dir))
def ensure_dir_exists ( verify_dir ) : if not os . path . exists ( verify_dir ) : os . makedirs ( verify_dir ) else : if not os . path . isdir ( verify_dir ) : raise ValueError ( "{} is not a directory" . format ( verify_dir ) )
Ensure directory exists. Create if necessary.