from typing import TextIO
from typing import Optional


def next_line(fh: TextIO) -> Optional[str]:
    """ Return the next line from a filehandle """

    try:
        return next(fh).rstrip()
    except StopIteration:
        return None