'Extract the value for this field from a row
@param row: the Row
@param represent: render a text representation for the value
@param lazy: return a lazy representation handle if available'

def extract(self, row, represent=False, lazy=False):

    tname = self.tname
    fname = self.fname
    colname = self.colname
    error = ('Field    not    found    in    Row:    %s' % colname)
    if (type(row) is Row):
        try:
            if (tname in row.__dict__):
                value = ogetattr(ogetattr(row, tname), fname)
            else:
                value = ogetattr(row, fname)
        except:
            try:
                value = row[colname]
            except (KeyError, AttributeError):
                raise KeyError(error)
    elif (fname in row):
        value = row[fname]
    elif (colname in row):
        value = row[colname]
    elif ((tname is not None) and (tname in row) and (fname in row[tname])):
        value = row[tname][fname]
    else:
        raise KeyError(error)
    if callable(value):
        try:
            value = value()
        except:
            current.log.error(sys.exc_info()[1])
            value = None
    if represent:
        renderer = self.represent
        if callable(renderer):
            if (lazy and hasattr(renderer, 'bulk')):
                return S3RepresentLazy(value, renderer)
            else:
                return renderer(value)
        else:
            return s3_unicode(value)
    else:
        return value
