def style_factory(name, cli_style):
try:<EOL><INDENT>style = pygments.styles.get_style_by_name(name)<EOL><DEDENT>except ClassNotFound:<EOL><INDENT>style = pygments.styles.get_style_by_name('<STR_LIT>')<EOL><DEDENT>style_tokens = {}<EOL>style_tokens.update(style.styles)<EOL>custom_styles = {string_to_tokentype(x): y for x, y in cli_style.items()}<EOL>style_tokens.update(custom_styles)<EOL>class CliStyle(pygments.style.Style):<EOL><INDENT>default_styles = '<STR_LIT>'<EOL>styles = style_tokens<EOL><DEDENT>return CliStyle<EOL>
Create a Pygments Style class based on the user's preferences.
    :param str name: The name of a built-in Pygments style.
    :param dict cli_style: The user's token-type style preferences.