<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sync(self, force=False, safe=True, revision=0, changelist=0):
 """Syncs the file at the current revision :param force: Force the file to sync :type force: bool :param safe: Don't sync files that were changed outside perforce :type safe: bool :param revision: Sync to a specific revision :type revision: int :param changelist: Changelist to sync to :type changelist: int """

        cmd = ['sync']
        if force:
            cmd.append('-f')

        if safe:
            cmd.append('-s')

        if revision:
            cmd.append('{}#{}'.format(self.depotFile, revision))
        elif changelist:
            cmd.append('{}@{}'.format(self.depotFile, changelist))
        else:
            cmd.append(self.depotFile)

        self._connection.run(cmd)

        self.query()