def vcard_from_vobject(vcard):
    vcard = fix_vobject(vcard)
    vdict = VCard()
    if vcard.name != "VCARD":
        raise Exception  # TODO proper Exception type
    for line in vcard.getChildren():
        # this might break, was tried/excepted before
        line.transformFromNative()
        property_name = line.name
        property_value = line.value

        try:
            if line.ENCODING_paramlist == [u'b'] or line.ENCODING_paramlist == [u'B']:
                property_value = base64.b64encode(line.value)

        except __HOLE__:
            pass
        if type(property_value) == list:
            property_value = (',').join(property_value)

        vdict[property_name].append((property_value, line.params,))
    return vdict
dataset/ETHPy150Open geier/pycarddav/pycarddav/model.py/vcard_from_vobject