'Get current admin subscription settings'

def _get_admin_subscription(self, subscription_id=None, pe_id=None):

    s3db = current.s3db
    stable = s3db.pr_subscription
    ftable = s3db.pr_filter
    output = {}
    get_vars = {}
    if (pe_id and subscription_id):
        query = (((stable.id == subscription_id) & (stable.deleted != True)) & (stable.pe_id == pe_id))
        left = ftable.on((ftable.id == stable.filter_id))
        row = current.db(query).select(stable.method, ftable.query, left=left, limitby=(0, 1)).first()
        if row:
            s = getattr(row, 'pr_subscription')
            f = getattr(row, 'pr_filter')
            if f.query:
                filters = json.loads(f.query)
                for (k, v) in filters:
                    if (v is None):
                        continue
                    if (k == 'info.language__belongs'):
                        k = 'language__belongs'
                    if (k == 'info.priority__belongs'):
                        k = 'priority__belongs'
                    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.update({'get_vars': get_vars, 'method': s.method})
    else:
        output.update({'get_vars': get_vars, 'method': stable.method.default})
    return output
