class_docstr: Singleton object containing the current figure templates (aka themes)
class_docstr_tok: ["Singleton","object","containing","the","current","figure","templates","(","aka","themes",")"]
docstr: Helper function for merge_templates that merges exactly two templates
  
  Parameters
  ----------
  template1: Template
  template2: Template
  
  Returns
  -------
  Template:
      merged template
docstr_tok: ["Helper","function","for","merge_templates","that","merges","exactly","two","templates","Parameters","--","--","--","--","--","template1",":","Template","template2",":","Template","Returns","--","--","--","-","Template",":","merged","template"]
code: def _merge_2_templates(self, template1, template2):
      """
      Helper function for merge_templates that merges exactly two templates
  
      Parameters
      ----------
      template1: Template
      template2: Template
  
      Returns
      -------
      Template:
          merged template
      """
      # Validate/copy input templates
      result = self._validate(template1)
      other = self._validate(template2)
  
      # Cycle traces
      for trace_type in result.data:
          result_traces = result.data[trace_type]
          other_traces = other.data[trace_type]
  
          if result_traces and other_traces:
              lcm = (
                  len(result_traces)
                  * len(other_traces)
                  // gcd(len(result_traces), len(other_traces))
              )
  
              # Cycle result traces
              result.data[trace_type] = result_traces * (
                  lcm // len(result_traces)
              )
  
              # Cycle other traces
              other.data[trace_type] = other_traces * (
                  lcm // len(other_traces)
              )
  
      # Perform update
      result.update(other)
  
      return result
  
imports: from __future__ import absolute_import
  import textwrap
  import pkgutil
  import copy
  import os
  import json
  from functools import reduce
  from six import string_types
label_desc: Use image node_id 17 for calling the TemplatesConfig obj's underlying member method code with example usage: obj._merge_2_templates(template1, template2) and returns: result