def extract_key_paths(base_path, collection):
    """Extracts key paths for collection and joins with base_path.

    If collection is list or tuple indexes will be added to base_path.
    If collection is dict keys will be added to base_path.

    :param base_path: list of indexes
    :param collection: collection
    :return: base_path extended by collection indexes
    """

    if isinstance(collection, dict):
        return [base_path + [k] for k in collection.keys()]
    elif isinstance(collection, (list, tuple)):
        return [base_path + [idx] for idx in range(len(collection))]
    else:
        return None