<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, data_source_id, update_data):
 """Update a Data Source. :param dict update_data: dict that contains fields that should be updated with new values. Fields that can be updated: * name * description * type * url * is_public * is_protected * credentials - dict with the keys `user` and `password` for data source in Swift, or with the keys `accesskey`, `secretkey`, `endpoint`, `ssl`, and `bucket_in_path` for data source in S3 """


        if self.version >= 2:
            UPDATE_FUNC = self._patch
        else:
            UPDATE_FUNC = self._update

        return UPDATE_FUNC('/data-sources/%s' % data_source_id,
                           update_data)