def get_n_document_from_yaml(yaml_generator, index=0):
    """
    Returns n document from yaml generator loaded by load_yaml with
    multi_document = True.

    Args:
        yaml_generator (generator): Generator from yaml.safe_load_all
        index (int): Index of document to return. (0 - 1st, 1 - 2nd document)

    Returns:
        dict: Data from n document from yaml file.

    Raises:
        IndexError: In case that yaml generator doesn't have such index.

    """
    for idx, document in enumerate(yaml_generator):
        if index == idx:
            return document
    raise IndexError(f"Passed yaml generator doesn't have index {index}")