def first_line(path):
    """
    :param str|None path: Path to file
    :return str|None: First line of file, if any
    """
    try:
        with io.open(path, "rt", errors="ignore") as fh:
            return fh.readline().strip()

    except (IOError, TypeError):
        return None
:param str|None path: Path to file
    :return str|None: First line of file, if any