def dict_to_attributes_code(dict_):
lines = []<EOL>for key, value in dict_.iteritems():<EOL><INDENT>if isinstance(value, dict):<EOL><INDENT>txt = dict_to_attributes_code(value)<EOL>lines_ = txt.split('<STR_LIT:\n>')<EOL>for line in lines_:<EOL><INDENT>if not line.startswith('<STR_LIT:U+0020>'):<EOL><INDENT>line = "<STR_LIT>" % (key, line)<EOL><DEDENT>lines.append(line)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>value_txt = pformat(value)<EOL>if '<STR_LIT:\n>' in value_txt:<EOL><INDENT>lines.append("<STR_LIT>" % key)<EOL>value_txt = indent(value_txt)<EOL>lines.extend(value_txt.split('<STR_LIT:\n>'))<EOL><DEDENT>else:<EOL><INDENT>line = "<STR_LIT>" % (key, value_txt)<EOL>lines.append(line)<EOL><DEDENT><DEDENT><DEDENT>return '<STR_LIT:\n>'.join(lines)<EOL>
Given a nested dict, generate a python code equivalent.

    Example:
        >>> d = {'foo': 'bah', 'colors': {'red': 1, 'blue': 2}}
        >>> print dict_to_attributes_code(d)
        foo = 'bah'
        colors.red = 1
        colors.blue = 2

    Returns:
        str.