Given a mapping and JSON schema spec, extract a value from ``data``
    and apply certain transformations to normalize the value.

def extract_value(mapping, bind, data):
    """ Given a mapping and JSON schema spec, extract a value from ``data``
    and apply certain transformations to normalize the value. """
    columns = mapping.get('columns', [mapping.get('column')])
    values = [data.get(c) for c in columns]

    for transform in mapping.get('transforms', []):
        # any added transforms must also be added to the schema.
        values = list(TRANSFORMS[transform](mapping, bind, values))

    format_str = mapping.get('format')
    value = values[0] if len(values) else None
    if not is_empty(format_str):
        value = format_str % tuple('' if v is None else v for v in values)

    empty = is_empty(value)
    if empty:
        value = mapping.get('default') or bind.schema.get('default')
    return empty, convert_value(bind, value)