'Set the realm entity of Group Membership records to the same as
that of the person'

@staticmethod
def group_membership_realm_entity(table, row):

    db = current.db
    s3db = current.s3db
    gtable = s3db.pr_group
    group = db((gtable.id == row.group_id)).select(gtable.realm_entity, limitby=(0, 1)).first()
    try:
        return group.realm_entity
    except:
        return None
