nodes: 0, module; 1, function_definition; 2, function_name:format_name; 3, parameters; 4, block; 5, identifier:subject; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:"""Convert a subject into the canonical form for distinguished names.
  
      This function does not take care of sorting the subject in any meaningful order.
  
      Examples::
  
          >>> format_name([('CN', 'example.com'), ])
          '/CN=example.com'
          >>> format_name([('CN', 'example.com'), ('O', "My Organization"), ])
          '/CN=example.com/O=My Organization'
      """; 10, call; 11, block; 12, binary_operator:'/%s' % ('/'.join(['%s=%s' % (force_text(k), force_text(v)) for k, v in subject])); 13, identifier:isinstance; 14, argument_list; 15, expression_statement; 16, string; 17, parenthesized_expression; 18, identifier:subject; 19, attribute; 20, assignment; 21, string_content:/%s; 22, call; 23, identifier:x509; 24, identifier:Name; 25, identifier:subject; 26, list_comprehension; 27, attribute; 28, argument_list; 29, tuple; 30, for_in_clause; 31, string; 32, identifier:join; 33, list_comprehension; 34, subscript; 35, attribute; 36, identifier:s; 37, identifier:subject; 38, string_content:/; 39, binary_operator:'%s=%s' % (force_text(k), force_text(v)); 40, for_in_clause; 41, identifier:OID_NAME_MAPPINGS; 42, attribute; 43, identifier:s; 44, identifier:value; 45, string; 46, tuple; 47, pattern_list; 48, identifier:subject; 49, identifier:s; 50, identifier:oid; 51, string_content:%s=%s; 52, call; 53, call; 54, identifier:k; 55, identifier:v; 56, identifier:force_text; 57, argument_list; 58, identifier:force_text; 59, argument_list; 60, identifier:k; 61, identifier:v
code: def format_name(subject):
      """Convert a subject into the canonical form for distinguished names.
  
      This function does not take care of sorting the subject in any meaningful order.
  
      Examples::
  
          >>> format_name([('CN', 'example.com'), ])
          '/CN=example.com'
          >>> format_name([('CN', 'example.com'), ('O', "My Organization"), ])
          '/CN=example.com/O=My Organization'
      """
      if isinstance(subject, x509.Name):
          subject = [(OID_NAME_MAPPINGS[s.oid], s.value) for s in subject]
  
      return '/%s' % ('/'.join(['%s=%s' % (force_text(k), force_text(v)) for k, v in subject]))