def put_file(self,
                 name,
                 filename,
                 to_local_store=True,
                 to_remote_store=True,
                 compress_hint=True):
        if not to_local_store and not to_remote_store:
            raise ValueError("Neither to_local_store nor to_remote_store set "
                             "in a call to filetracker.Client.put_file")
        check_name(name)
        lock = None
        if self.local_store:
            lock = self.lock_manager.lock_for(name)
            lock.lock_exclusive()
        try:
            if (to_local_store or not self.remote_store) and self.local_store:
                versioned_name = self.local_store.add_file(name, filename)
            if (to_remote_store or not self.local_store) and self.remote_store:
                versioned_name = self.remote_store.add_file(
                        name, filename, compress_hint=compress_hint)
        finally:
            if lock:
                lock.close()
        return versioned_name