def f_line_count_fd(stream, *args, **kwargs):
	"""
	A quick utility function to count the remaining number of
	lines in an already opened stream. If the stream is seekable,
	this function will save and revert to the original position
	after counting

	:param stream
		A stream object which may be iterated line by line.

	:param offset
		A numeric offset to apply to the resulting line count.
	
	:return int
		The number of lines remaining in the given stream.
	"""
	prev = None
	if stream.seekable():
		prev = stream.tell()
	
	lines = 0
	if "offset" in kwargs:
		lines += kwargs["offset"]
	for _ in stream:
		lines += 1
	
	if prev is not None:
		stream.seek(prev)
	
	return lines