code: def replace_widgets(self, widgets, team_context, dashboard_id, eTag=None):
          
          project = None
          team = None
          if team_context is not None:
              if team_context.project_id:
                  project = team_context.project_id
              else:
                  project = team_context.project
              if team_context.team_id:
                  team = team_context.team_id
              else:
                  team = team_context.team
  
          route_values = {}
          if project is not None:
              route_values['project'] = self._serialize.url('project', project, 'string')
          if team is not None:
              route_values['team'] = self._serialize.url('team', team, 'string')
          if dashboard_id is not None:
              route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
          content = self._serialize.body(widgets, '[Widget]')
          response = self._send(http_method='PUT',
                                location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
                                version='5.0-preview.2',
                                route_values=route_values,
                                content=content)
          response_object = models.WidgetsVersionedList()
          response_object.widgets = self._deserialize('[Widget]', self._unwrap_collection(response))
          response_object.eTag = response.headers.get('ETag')
          return response_object
docs: ReplaceWidgets.
          [Preview API] Replace the widgets on specified dashboard with the supplied widgets.
          :param [Widget] widgets: Revised state of widgets to store for the dashboard.
          :param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
          :param str dashboard_id: ID of the Dashboard to modify.
          :param String eTag: Dashboard Widgets Version
          :rtype: :class:`<WidgetsVersionedList> <azure.devops.v5_0.dashboard.models.WidgetsVersionedList>`