'Check whether a record has been approved or not
@param table: the table
@param record: the record or record ID
@param approved: True = check if approved,
False = check if unapproved'

def approved(self, table, record, approved=True):

    if (('approved_by' not in table.fields) or (not self.requires_approval(table))):
        return approved
    if isinstance(record, (Row, dict)):
        if ('approved_by' not in record):
            record_id = record[table._id]
            record = None
    else:
        record_id = record
        record = None
    if ((record is None) and record_id):
        record = current.db((table._id == record_id)).select(table.approved_by, limitby=(0, 1)).first()
        if (not record):
            return False
    if (approved and (record['approved_by'] is not None)):
        return True
    elif ((not approved) and (record['approved_by'] is None)):
        return True
    else:
        return False
