@classmethod<EOL><INDENT>def convert(cls, style_dict, num_format_str=None):<DEDENT>
<EOL>props = {}<EOL>if num_format_str is not None:<EOL><INDENT>props['<STR_LIT>'] = num_format_str<EOL><DEDENT>if style_dict is None:<EOL><INDENT>return props<EOL><DEDENT>if '<STR_LIT>' in style_dict:<EOL><INDENT>style_dict = style_dict.copy()<EOL>style_dict['<STR_LIT>'] = style_dict.pop('<STR_LIT>')<EOL><DEDENT>for style_group_key, style_group in style_dict.items():<EOL><INDENT>for src, dst in cls.STYLE_MAPPING.get(style_group_key, []):<EOL><INDENT>if dst in props:<EOL><INDENT>continue<EOL><DEDENT>v = style_group<EOL>for k in src:<EOL><INDENT>try:<EOL><INDENT>v = v[k]<EOL><DEDENT>except (KeyError, TypeError):<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>props[dst] = v<EOL><DEDENT><DEDENT><DEDENT>if isinstance(props.get('<STR_LIT>'), str):<EOL><INDENT>props['<STR_LIT>'] = <NUM_LIT:0> if props['<STR_LIT>'] == '<STR_LIT:none>' else <NUM_LIT:1><EOL><DEDENT>for k in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT:right>', '<STR_LIT>', '<STR_LIT:left>']:<EOL><INDENT>if isinstance(props.get(k), str):<EOL><INDENT>try:<EOL><INDENT>props[k] = ['<STR_LIT:none>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'].index(props[k])<EOL><DEDENT>except ValueError:<EOL><INDENT>props[k] = <NUM_LIT:2><EOL><DEDENT><DEDENT><DEDENT>if isinstance(props.get('<STR_LIT>'), str):<EOL><INDENT>props['<STR_LIT>'] = ['<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>'].index(props['<STR_LIT>'])<EOL><DEDENT>if isinstance(props.get('<STR_LIT>'), str):<EOL><INDENT>props['<STR_LIT>'] = {'<STR_LIT:none>': <NUM_LIT:0>, '<STR_LIT>': <NUM_LIT:1>, '<STR_LIT>': <NUM_LIT:2>,<EOL>'<STR_LIT>': <NUM_LIT>,<EOL>'<STR_LIT>': <NUM_LIT>}[props['<STR_LIT>']]<EOL><DEDENT>return props<EOL>
converts a style_dict to an xlsxwriter format dict

Parameters
----------
style_dict : style dictionary to convert
num_format_str : optional number format string