code: def Builder(**kw):
      
      composite = None
      if 'generator' in kw:
          if 'action' in kw:
              raise UserError("You must not specify both an action and a generator.")
          kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {})
          del kw['generator']
      elif 'action' in kw:
          source_ext_match = kw.get('source_ext_match', 1)
          if 'source_ext_match' in kw:
              del kw['source_ext_match']
          if SCons.Util.is_Dict(kw['action']):
              composite = DictCmdGenerator(kw['action'], source_ext_match)
              kw['action'] = SCons.Action.CommandGeneratorAction(composite, {})
              kw['src_suffix'] = composite.src_suffixes()
          else:
              kw['action'] = SCons.Action.Action(kw['action'])
  
      if 'emitter' in kw:
          emitter = kw['emitter']
          if SCons.Util.is_String(emitter):
              # This allows users to pass in an Environment
              # variable reference (like "$FOO") as an emitter.
              # We will look in that Environment variable for
              # a callable to use as the actual emitter.
              var = SCons.Util.get_environment_var(emitter)
              if not var:
                  raise UserError("Supplied emitter '%s' does not appear to refer to an Environment variable" % emitter)
              kw['emitter'] = EmitterProxy(var)
          elif SCons.Util.is_Dict(emitter):
              kw['emitter'] = DictEmitter(emitter)
          elif SCons.Util.is_List(emitter):
              kw['emitter'] = ListEmitter(emitter)
  
      result = BuilderBase(**kw)
  
      if not composite is None:
          result = CompositeBuilder(result, composite)
  
      return result
docs: A factory for builder objects.