'Convert b into the data type of a
@raise TypeError: if any of the data types are not supported
or the types are incompatible
@raise ValueError: if the value conversion fails'

@classmethod
def convert(cls, a, b):

    if isinstance(a, lazyT):
        a = str(a)
    if (b is None):
        return None
    if (type(a) is type):
        if (a in (str, unicode)):
            return cls._str(b)
        if (a is int):
            return cls._int(b)
        if (a is bool):
            return cls._bool(b)
        if (a is long):
            return cls._long(b)
        if (a is float):
            return cls._float(b)
        if (a is datetime.datetime):
            return cls._datetime(b)
        if (a is datetime.date):
            return cls._date(b)
        if (a is datetime.time):
            return cls._time(b)
        raise TypeError
    if ((type(b) is type(a)) or isinstance(b, type(a))):
        return b
    if isinstance(a, (list, tuple, set)):
        if isinstance(b, (list, tuple, set)):
            return b
        elif isinstance(b, basestring):
            if (',' in b):
                b = b.split(',')
            else:
                b = [b]
        else:
            b = [b]
        if len(a):
            cnv = cls.convert
            return [cnv(a[0], item) for item in b]
        else:
            return b
    if isinstance(b, (list, tuple, set)):
        cnv = cls.convert
        return [cnv(a, item) for item in b]
    if isinstance(a, basestring):
        return cls._str(b)
    if isinstance(a, bool):
        return cls._bool(b)
    if isinstance(a, int):
        return cls._int(b)
    if isinstance(a, long):
        return cls._long(b)
    if isinstance(a, float):
        return cls._float(b)
    if isinstance(a, datetime.datetime):
        return cls._datetime(b)
    if isinstance(a, datetime.date):
        return cls._date(b)
    if isinstance(a, datetime.time):
        return cls._time(b)
    raise TypeError
