def get_class_method(cls_or_inst, method_name):
cls = cls_or_inst if isinstance(cls_or_inst, type) else cls_or_inst.__class__<EOL>meth = getattr(cls, method_name, None)<EOL>if isinstance(meth, property):<EOL><INDENT>meth = meth.fget<EOL><DEDENT>elif isinstance(meth, cached_property):<EOL><INDENT>meth = meth.func<EOL><DEDENT>return meth<EOL>
Returns a method from a given class or instance. When the method doest not exist, it returns `None`. Also works with
properties and cached properties.