docs: def bundle_variant(args, l, rc):
      """Create a new bundle as a variant of an existing bundle"""
  
      from ambry.orm.exc import ConflictError
  
      ob = l.bundle(args.ref)
  
      d = dict(
          dataset=args.dataset or ob.identity.dataset,
          revision=args.revision,
          source=args.source or ob.identity.source,
          bspace=args.space or ob.identity.bspace,
          subset=args.subset or ob.identity.subset,
          btime=args.time or ob.identity.btime,
          variation=args.variation or ob.identity.variation)
  
      try:
          ambry_account = rc.accounts.get('ambry', {})
      except:
          ambry_account = None
  
      if not ambry_account:
          fatal("Failed to get an accounts.ambry entry from the configuration. ")
  
      if not ambry_account.get('name') or not ambry_account.get('email'):
          fatal('Must set accounts.ambry.email and accounts.ambry.name n account config file')
  
      try:
          b = l.new_bundle(assignment_class=args.key, **d)
          b.metadata.contacts.wrangler.name = ambry_account.get('name')
          b.metadata.contacts.wrangler.email = ambry_account.get('email')
          b.commit()
  
      except ConflictError:
          fatal("Can't create dataset; one with a conflicting name already exists")
  
      # Now, need to copy over all of the partitions into the new bundle.
      for p in ob.partitions:
          ds = b.dataset.new_source(p.name, ref=p.name, reftype='partition')
          print ds
  
      b.build_source_files.sources.objects_to_record()
  
      b.commit()