import sys

__all__ = ["is_call_internal"]

def is_call_internal(obj, level= 1):
    """ checks is a call to a function is done from within the object or from outside """
    f = sys._getframe(1 + level).f_locals
    if not "self" in f: return False
    return (f["self"] is obj)

