def flatten_keys(dictionary):
    """
    Flattens the keys for a nested dictionary using dot notation. This
    returns all the keys which can be accessed via `get_by_path`.

    Example:
        For example, {'a': None, 'b': {'x': None}} would return ['a', 'b.x']

    Args:
        dictionary (dict):
            A dictionary which should be flattened.

    Returns:
        list[str]: list of flattened keys
    """
    if not isinstance(dictionary, dict):
        return []
    keys = []
    for k, v in dictionary.items():
        if isinstance(v, dict):
            for x in flatten_keys(v):
                keys.append(k + '.' + x)
        else:
            keys.append(k)
    return keys