code: def update_extension(self, upload_stream, publisher_name, extension_name, bypass_scope_check=None, **kwargs):
          
          route_values = {}
          if publisher_name is not None:
              route_values['publisherName'] = self._serialize.url('publisher_name', publisher_name, 'str')
          if extension_name is not None:
              route_values['extensionName'] = self._serialize.url('extension_name', extension_name, 'str')
          query_parameters = {}
          if bypass_scope_check is not None:
              query_parameters['bypassScopeCheck'] = self._serialize.query('bypass_scope_check', bypass_scope_check, 'bool')
          if "callback" in kwargs:
              callback = kwargs["callback"]
          else:
              callback = None
          content = self._client.stream_upload(upload_stream, callback=callback)
          response = self._send(http_method='PUT',
                                location_id='e11ea35a-16fe-4b80-ab11-c4cab88a0966',
                                version='5.1-preview.2',
                                route_values=route_values,
                                query_parameters=query_parameters,
                                content=content,
                                media_type='application/octet-stream')
          return self._deserialize('PublishedExtension', response)
docs: UpdateExtension.
          [Preview API] REST endpoint to update an extension.
          :param object upload_stream: Stream to upload
          :param str publisher_name: Name of the publisher
          :param str extension_name: Name of the extension
          :param bool bypass_scope_check: This parameter decides if the scope change check needs to be invoked or not
          :rtype: :class:`<PublishedExtension> <azure.devops.v5_1.gallery.models.PublishedExtension>`