def format_role(name, rawtext, text, lineno, inliner, options=None, content=None):
if options is None:<EOL><INDENT>options = {}<EOL><DEDENT>if content is None:<EOL><INDENT>content = []<EOL><DEDENT>name, _, format_spec = tuple(field.strip() for field in text.partition("<STR_LIT:U+002C>"))<EOL>try:<EOL><INDENT>prefixed_name, obj, parent, modname = import_by_name(name)<EOL><DEDENT>except ImportError:<EOL><INDENT>msg = inliner.reporter.error("<STR_LIT>".format(text), line=lineno)<EOL>prb = inliner.problematic(rawtext, rawtext, msg)<EOL>return [prb], [msg]<EOL><DEDENT>app = inliner.document.settings.env.app<EOL>try:<EOL><INDENT>formatted_value = format(obj, format_spec)<EOL><DEDENT>except ValueError as value_error:<EOL><INDENT>msg = inliner.reporter.error(<EOL>"<STR_LIT>".format(text, value_error), line=lineno<EOL>)<EOL>prb = inliner.problematic(rawtext, rawtext, msg)<EOL>return [prb], [msg]<EOL><DEDENT>node = nodes.Text(formatted_value, rawsource=rawtext)<EOL>return [node], []<EOL>
Include Python object value, rendering it to text using str.

    Returns 2 part tuple containing list of nodes to insert into the
    document and a list of system messages.  Both are allowed to be
    empty.

    :param make_node: A callable which accepts (rawtext, app, prefixed_name, obj, parent, modname, options) and which returns a node
    :param name: The role name used in the document.
    :param rawtext: The entire markup snippet, with role.
    :param text: The text marked with the role.
    :param lineno: The line number where rawtext appears in the input.
    :param inliner: The inliner instance that called us.
    :param options: Directive options for customization.
    :param content: The directive content for customization.