<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def file_exists_on_unit(self, sentry_unit, file_name):
 """Check if a file exists on a unit."""

        try:
            sentry_unit.file_stat(file_name)
            return True
        except IOError:
            return False
        except Exception as e:
            msg = 'Error checking file {}: {}'.format(file_name, e)
            amulet.raise_status(amulet.FAIL, msg=msg)