'Get current recipient and the current group settings'

def _get_recipients_and_groups(self, subscription_id=None, pe_id=None, caller=None):

    stable = current.s3db.pr_subscription
    get_vars = {}
    if ((pe_id is not None) and (subscription_id is not None)):
        query = (((stable.id == subscription_id) & (stable.deleted != True)) & (stable.pe_id == pe_id))
        row = current.db(query).select(stable.comments, limitby=(0, 1)).first()
        comments = json.loads(row.comments)
        if ((row is not None) and (comments is not None)):
            if ((caller == 'recipients') and ('auth_user.id' in comments)):
                filters = [['id__belongs', ('%s' % str(comments['auth_user.id']))]]
            elif ((caller == 'groups') and ('pr_group.id' in comments)):
                filters = [['id__belongs', ('%s' % str(comments['pr_group.id']))]]
            else:
                filters = None
            if (filters is not None):
                for (k, v) in filters:
                    if (v is None):
                        continue
                    if (k in get_vars):
                        if (type(get_vars[k]) is list):
                            get_vars[k].append(v)
                        else:
                            get_vars[k] = [get_vars[k], v]
                    else:
                        get_vars[k] = v
    output = {'get_vars': get_vars}
    return output
