def transform_attributes(attrs, cls):
transformed = {}<EOL>for key, value in attrs.items():<EOL><INDENT>if value is None:<EOL><INDENT>value = "<STR_LIT>"<EOL><DEDENT>if key == "<STR_LIT:text>":<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>if cls == DiasporaProfile:<EOL><INDENT>profile = retrieve_and_parse_profile(value)<EOL>transformed['<STR_LIT:id>'] = value<EOL>transformed["<STR_LIT>"] = profile.guid<EOL><DEDENT>else:<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key == '<STR_LIT>':<EOL><INDENT>if cls != DiasporaProfile:<EOL><INDENT>transformed["<STR_LIT:id>"] = value<EOL>transformed["<STR_LIT>"] = value<EOL><DEDENT><DEDENT>elif key in ("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key in ("<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key in ("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>values = [attrs.get('<STR_LIT>'), attrs.get('<STR_LIT>')]<EOL>values = [v for v in values if v]<EOL>transformed["<STR_LIT:name>"] = "<STR_LIT:U+0020>".join(values)<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" not in transformed:<EOL><INDENT>transformed["<STR_LIT>"] = {}<EOL><DEDENT>transformed["<STR_LIT>"]["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" not in transformed:<EOL><INDENT>transformed["<STR_LIT>"] = {}<EOL><DEDENT>transformed["<STR_LIT>"]["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" not in transformed:<EOL><INDENT>transformed["<STR_LIT>"] = {}<EOL><DEDENT>transformed["<STR_LIT>"]["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>if value:<EOL><INDENT>transformed["<STR_LIT>"] = value.replace("<STR_LIT:#>", "<STR_LIT>").split("<STR_LIT:U+0020>")<EOL><DEDENT><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>transformed["<STR_LIT>"] = True if value == "<STR_LIT:true>" else False<EOL><DEDENT>elif key in ["<STR_LIT>"] and cls == DiasporaRetraction:<EOL><INDENT>transformed["<STR_LIT>"] = DiasporaRetraction.entity_type_from_remote(value)<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL>transformed["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>transformed["<STR_LIT>"] = value<EOL><DEDENT>elif key in BOOLEAN_KEYS:<EOL><INDENT>transformed[key] = True if value == "<STR_LIT:true>" else False<EOL><DEDENT>elif key in DATETIME_KEYS:<EOL><INDENT>transformed[key] = datetime.strptime(value, "<STR_LIT>")<EOL><DEDENT>elif key in INTEGER_KEYS:<EOL><INDENT>transformed[key] = int(value)<EOL><DEDENT>else:<EOL><INDENT>transformed[key] = value<EOL><DEDENT><DEDENT>return transformed<EOL>
Transform some attribute keys.

    :param attrs: Properties from the XML
    :type attrs: dict
    :param cls: Class of the entity
    :type cls: class