from typing import Union
from typing import List
from typing import Tuple


def keyword_split(x: str, keywords: Union[List, Tuple], return_idx: int=2) -> str:
    """
    Extract portion of string given a list of possible delimiters (keywords) via partition method

    Args:
        x (`str`):
            Note to select text from
        keywords (`List` or `Tuple`):
            Possible keywords to partition `x` on, searching in order
        return_idx (`int`):
            Return index from :meth:`partition`'s 3-tuple

    Returns:
        [`str`] Partitioned note
    """

    for keyword in keywords:
        if x.partition(keyword)[2] !='':
            return x.partition(keyword)[return_idx]
    return x