def _get_by_path(dic, keys):
    """
    Access a nested object in dic by key sequence.

    Parameters
    ----------
    dic : dict
        The dictionary.
    keys : list
        The key sequence.

    Returns
    -------
        dict
            The dictionary object if found, None otherwise

    """
    assert len(keys) > 0, "Path key can not be an empty list."

    d = dic
    for key in keys[:-1]:
        if isinstance(key, int) or key in d:
            d = d[key]
        else:
            return None
    if keys[-1] in d or (isinstance(d, list) and keys[-1] < len(d)):
        return d[keys[-1]]

    return None