import re


def parse_log(filename: str) -> str:
  """Extracts and returns the delay from the given log file path."""
  with open(filename, 'r') as log_file:
    info = log_file.read()
    delay_statement = 'Max delay <async> -> <async>: '
    locs = [m.start() for m in re.finditer(delay_statement, info)]
    # If there is no delay statement, we know it has been optimized
    # to a constant.
    if not locs:
      return '0.0'
    # Want to extract the final delay
    idx = locs[-1] + len(delay_statement)
    end = idx
    while info[end] != ' ':
      end += 1
    return info[idx:end]