def logtail(fh, date_format, start_date, field, parser=None, delimiter=None,
            **kwargs):
            
    dt_start = dateutil.parser.parse(start_date)
    _is_match = partial(_is_match_full, date_format=date_format, dt_start=dt_start)
   
    _is_match_func = _is_match
    if parser:
        # Custom parser specified, use field-based matching
        parser = eval(parser, vars(logtools.parsers), {})()
        is_indices = field.isdigit()
        if is_indices:
            # Field index based matching
            def _is_match_func(line):
                parsed_line = parser(line)
                return _is_match(parsed_line.by_index(field))
        else:
            # Named field based matching
            def _is_match_func(line):
                parsed_line = parser(line)
                return _is_match(parsed_line.by_index(field))
    else:
        # No custom parser, field/delimiter-based extraction
        def _is_match_func(line):
            val = line.split(delimiter)[int(field)-1]
            return _is_match(val)
                
    num_lines=0
    num_filtered=0
    num_nomatch=0
    for line in imap(lambda x: x.strip(), fh):
        try:
             is_match = _is_match_func(line)
        except (KeyError, ValueError):
            # Parsing error
            logging.warn("No match for line: %s", line)
            num_nomatch +=1
            continue
        else:
            if not is_match:
                logging.debug("Filtering line: %s", line)
                num_filtered += 1
                continue

            num_lines+=1
            yield line

    logging.info("Number of lines after filtering: %s", num_lines)
    logging.info("Number of lines filtered: %s", num_filtered)        
    if num_nomatch:
        logging.info("Number of lines could not match on: %s", num_nomatch)

    return
Tail rows from logfile, based on complex expressions such as a
dataset/ETHPy150Open adamhadani/logtools/logtools/_tail.py/logtail