def count_lines_in_file(file, ignore_header=True):
    """
    Counts number of records in a file. This assumes each record is defined in
    a single line. Similar but not limited to CSV files. By default, consider
    and ignores the header row (First row) from the count.

    Args:
        file - Path to file
        ignore_header - If True, ignores first line in count. If False, returns
        count of all lines in file
    """

    count = sum(1 for _ in open(file))

    if ignore_header:
        return count - 1
    return count