def line_count_file(file_path, flags=None):
    """ Counts lines for given file in file_name """
    try:
        count = 0
        with open(file_path, encoding='ascii', errors='surrogateescape'
            ) as current_file:
            for line in current_file:
                if line.strip(
                    ) == '' and flags != None and '--noempty' in flags:
                    continue
                count += 1
        return count
    except IOError:
        return -1
