code: def configure_mock(self, **kwargs):
          
          for arg, val in sorted(kwargs.items(),
                                 # we sort on the number of dots so that
                                 # attributes are set before we set attributes on
                                 # attributes
                                 key=lambda entry: entry[0].count('.')):
              args = arg.split('.')
              final = args.pop()
              obj = self
              for entry in args:
                  obj = getattr(obj, entry)
              setattr(obj, final, val)
docs: Set attributes on the mock through keyword arguments.
  
          Attributes plus return values and side effects can be set on child
          mocks using standard dot notation and unpacking a dictionary in the
          method call:
  
          >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
          >>> mock.configure_mock(**attrs)