Check a dict for the existence of a value given a path to it.

    :param source: a dict to read data from
    :param path: a key or path to a key (path is delimited by `separator`)
    :keyword separator: the separator used in the path (ex. Could be "." for a
        json/mongodb type of value)

def path_exists(source, path, separator='/'):
    """Check a dict for the existence of a value given a path to it.

    :param source: a dict to read data from
    :param path: a key or path to a key (path is delimited by `separator`)
    :keyword separator: the separator used in the path (ex. Could be "." for a
        json/mongodb type of value)
    """
    if path == separator and isinstance(source, dict):
        return True
    parts = path.strip(separator).split(separator)
    if not parts:
        return False
    current = source
    for part in parts:
        if not isinstance(current, dict):
            return False
        if part not in current:
            return False
        current = current[part]
    return True