def validate_database_path(database):
    p = os.path.abspath(database)
    if not os.path.exists(p):
        raise ValueError('No such file or directory')
    if os.path.isfile(p):
        p = os.path.dirname(p)
    if not os.path.isdir(p):
        raise ValueError('Not a directory')
    return p
RestructuredText processing with optionnally custom settings.
dataset/ETHPy150Open NVIDIA/DIGITS/tools/analyze_db.py/validate_database_path--crossover with--dataset/ETHPy150Open Fantomas42/django-blog-zinnia/zinnia/markups.py/restructuredtext