how to find if the file is a link file, and find the path of the target file (actual file pointed by the link file)
Use os.lstat(), then inspect the st_mode field.
os.lstat()
st_mode