def METHOD_NAME(
    log,  # type: str
    timeout,  # type: float
):
    # type: (...) -> Optional[str]
    start = time.time()
    while time.time() - start < timeout:
        with open(log) as fp:
            for line in fp:
                if line.endswith(os.linesep):
                    match = re.search(r"Serving on (?P<url>http://\S+)$", line)
                    if match:
                        return match.group("url")
    return None