def _GetFrameCodeObjectName(frame):
  """Gets the code object name for the frame.

  Args:
    frame: the frame to get the name from

  Returns:
    The function name if the code is a static function or the class name with
    the method name if it is an member function.
  """
  # This functions under the assumption that member functions will name their
  # first parameter argument 'self' but has some edge-cases.
  if frame.f_code.co_argcount >= 1 and 'self' == frame.f_code.co_varnames[0]:
    return (frame.f_locals['self'].__class__.__name__ +
            '.' + frame.f_code.co_name)
  else:
    return frame.f_code.co_name