def owns_object(self, obj):
    from app.modules.assets.models import Asset
    from app.modules.asset_groups.models import AssetGroup
    from app.modules.encounters.models import Encounter
    from app.modules.sightings.models import Sighting
    from app.modules.projects.models import Project
    from app.modules.individuals.models import Individual
    from app.modules.notifications.models import Notification
    ret_val = False
    if isinstance(obj, User):
        ret_val = (obj == self)
    elif isinstance(obj, (AssetGroup, Encounter, Project, Notification)):
        ret_val = (obj.owner == self)
    elif isinstance(obj, Asset):
        if (obj.asset_group is not None):
            ret_val = (obj.asset_group.owner is self)
    elif isinstance(obj, Sighting):
        ret_val = False
    elif isinstance(obj, Individual):
        for encounter in obj.get_encounters():
            if (encounter.get_owner() is self):
                ret_val = True
                break
    return ret_val
def owns_object(self, obj):
    from app.modules.assets.models import Asset
    from app.modules.asset_groups.models import AssetGroup
    from app.modules.encounters.models import Encounter
    from app.modules.sightings.models import Sighting
    from app.modules.projects.models import Project
    from app.modules.individuals.models import Individual
    from app.modules.notifications.models import Notification
    ret_val = False
    if isinstance(obj, User):
        ret_val = (obj == self)
    elif isinstance(obj, (AssetGroup, Encounter, Project, Notification)):
        ret_val = (obj.owner == self)
    elif isinstance(obj, Asset):
        if (obj.asset_group is not None):
            ret_val = (obj.asset_group.owner is self)
    elif isinstance(obj, Sighting):
        ret_val = False
    elif isinstance(obj, Individual):
        for encounter in obj.get_encounters():
            if (encounter.get_owner() is self):
                ret_val = True
                break
    return ret_val