title: Get the "name" of a mock object (using a builtin method)
body: <p>The <code>__repr__</code>esentation of a Mock object that has been obtained as an attribute (or as the return of <code>__call__</code>) of another Mock shows what looks like a <code>name</code> attribute. This pseudoattribute however doesn't seem to exist in the class. For example:</p>
  
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; import mock
  ... x = mock.MagicMock()
  ... y = x.asdf
  ... z = y.hjkl
  ... a = z()
  
  &gt;&gt;&gt; a
  &lt;MagicMock name='mock.asdf.hjkl()' id='139706648472600'&gt;
  
  &gt;&gt;&gt; 'name' in a.__dict__
  False
  </code></pre>
  
  <p>In order to get this psuedoattribute, it seems that I can either parse the return of <code>y.__repr__()</code> or some sort of recursive function like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>def get_mock_name(some_mock):
      if some_mock._mock_name:
          return f'{get_mock_name(some_mock._mock_parent)}.{some_mock._mock_name}'
      elif some_mock._mock_new_name:
          return f'{get_mock_name(some_mock._mock_new_parent)}{some_mock._mock_new_name}'
      else:
          return 'mock'                                                        
  </code></pre>
  
  <p>While both work, is there any <strong><em>standard and/or builtin way</em></strong> of doing this?</p>
  
  <p>Edit: no, I am not asking how to override <code>__repr__</code></p>