def check_path(path, credentials=None):
    """
    Check that specified output path does not already exist

    The ValueError message will suggest calling with overwrite=True;
    this function is expected to be called from the various output methods
    that accept an 'overwrite' keyword argument.
    """
    from thunder.readers import get_file_reader
    reader = get_file_reader(path)(credentials=credentials)
    existing = reader.list(path, directories=True)
    if existing:
        raise ValueError(
            'Path %s appears to already exist. Specify a new directory, or call with overwrite=True to overwrite.'
             % path)
