def count_records(f):
    """Counts the number of empty lines in a file.

    :param f: file path
    :type f: FileIO or StringIO
    :return: number of empty lines
    :rtype: int
    """
    c = 0
    for l in f.readlines():
        if l.strip() != '':
            c += 1
    f.seek(0)
    return c
