Extract _get_magic_method function
Use _get_magic_method in _infer_magic_method_call