from typing import Union


def filext(filename: str) -> Union[str, None]:
    """This grabs the extension of a filename. This is used to guess the MIMEtype of a file when sending it to the client."""

    if not "." in filename:
        return None

    return filename.rsplit(".", 1)[1].lower()