<human>:  What is a good Python code to get last record in file.
<bot>: Here is a Python code to get the last record in file

import os

def get_last_record(filename):
  """Returns the last record in a file."""
  with open(filename, "r") as f:
    for line in f:
      yield line

# Enter the filename
filename = "/home/rosey/Desktop/test.txt"

# Calling the function
last_record = get_last_record(filename)

# Printing the last record
print(last_record)

#Example Output
# <generator object get_last_record at 0x7ff59b7c87b0>

#Remember to inspect code for bugs.