from typing import Callable
from typing import Sequence


def randline(filename: str, randchoice: Callable[[Sequence[str]], str]) -> str:
    """
    return a randomly-selected line from the given file
    """
    with open(filename, "rt", encoding="utf-8") as fh:
        return randchoice(fh.readlines()).rstrip()