<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ins2dict(ins, kind=''):
 """Turn a SQLAlchemy Model instance to dict. :param ins: a SQLAlchemy instance. :param kind: specify which kind of dict tranformer should be called. :return: dict, instance data. If model has defined `to_xxx_dict`, then ins2dict(ins, 'xxx') will call `model.to_xxx_dict()`. Default kind is ''. If model not defined 'to_dict', then ins2dict will transform according by model column definition. """

    if kind and hasattr(ins, 'to_%s_dict' % kind):
        return getattr(ins, 'to_%s_dict' % kind)()
    elif hasattr(ins, 'to_dict'):
        return getattr(ins, 'to_dict')()
    else:
        return _turn_row_to_dict(ins)