code: def mock(self, path_string):
      patcher = patch(path_string)
      new_mock = patcher.start()
      self.addCleanup(patcher.stop)
      return new_mock
  
file_path: plotly.py/packages/python/chart-studio/chart_studio/tests/test_plot_ly/test_api/__init__.py
imports: from __future__ import absolute_import
  from requests import Response
  from chart_studio.session import sign_in
  from chart_studio.tests.utils import PlotlyTestCase
  import sys
label_desc: Use image node_id 1 for calling the PlotlyApiTestCase obj's underlying member method code with example usage: obj.mock(path_string) and returns: new_mock