code: def assemble_component(self, into_component, using_components):
          
          if not isinstance(using_components, list) or len(using_components) == 0:
              raise Exception('Must supply list of ComponentDefinitions')
  
          components = []
          sequence_annotations = []
          seq_elements = ''
  
          for k, c in enumerate(using_components):
              try:
                  self._components[c.identity]
              except KeyError:
                  raise Exception('Must already have defined ComponentDefinition in document')
              else:
                  identity = into_component.identity + '/' + c.identity
  
                  # All components are initially public, this can be changed later
                  component = Component(identity,
                                        c,
                                        'public',
                                        display_id=c.identity)
                  components.append(component)
  
                  # If there is a sequence on the ComponentDefinition use the first element
                  if len(c.sequences) > 0:
                      # Add the sequence to the document
                      self._add_sequence(c.sequences[0])
                      # Get start/end points of sequence
                      start = len(seq_elements) + 1 # The sequence is usually 1 indexed
                      end = start + len(c.sequences[0].elements)
                      # Add to the component sequence element
                      seq_elements += c.sequences[0].elements
                      # Create a Range object to hold seq range
                      range_identity = identity + '_sequence_annotation/range'
                      seq_range = Range(range_identity, start, end, display_id='range')
                      # Create a SequenceAnnotation object to hold the range
                      annot_identity = identity + '_sequence_annotation'
                      seq_annot = SequenceAnnotation(annot_identity,
                                                     component=component,
                                                     locations=[seq_range],
                                                     display_id=c.identity + '_sequence_annotation')
                      sequence_annotations.append(seq_annot)
  
          if seq_elements != '':
              seq_encoding = using_components[0].sequences[0].encoding
              seq_identity = '{}_sequence'.format(into_component.identity)
              seq = Sequence(seq_identity, seq_elements, encoding=seq_encoding)
              self._add_sequence(seq)
              into_component.sequences.append(seq)
  
          into_component.components = components
          into_component.sequence_annotations = sequence_annotations
docs: Assemble a list of already defined components into a structual hirearchy