parameters: (cls, target_name)
docstring: Attempts to build a target by name.
  
      This searches the set of installed targets in priority order to see if any
      of them are willing to handle the supplied name.
      If a target cannot be found, the program will be aborted.
      Args:
        target_name: The name of the target we are searching for.
      Returns:
        The target that matched.
docstring_summary: Attempts to build a target by name.
docstring_tokens: Attempts to build a target by name .
function: def CreateTarget(cls, target_name):
      """Attempts to build a target by name.
  
      This searches the set of installed targets in priority order to see if any
      of them are willing to handle the supplied name.
      If a target cannot be found, the program will be aborted.
      Args:
        target_name: The name of the target we are searching for.
      Returns:
        The target that matched.
      """
      target_clses = sorted(
          cls.AllTargets(),
          key=operator.attrgetter('PRIORITY'),
          reverse=True
      )
      for handler in target_clses:
        target = handler.Build(target_name)
        if target:
          if not target.valid:
            print 'Invalid target {0} as {1}'.format(
                target_name, target.build_target)
            guesses = cr.Builder.GuessTargets(target_name)
            if guesses:
              print 'Did you mean {0}?'.format(
                  ', '.join(guesses[:-1]) + ' or ' + guesses[-1]
                  if len(guesses) > 1 else guesses[0])
            exit(1)
          return target
      print 'Unknown target {0}'.format(target_name)
      exit(1)
function_tokens: def CreateTarget ( cls , target_name ) : target_clses = sorted ( cls . AllTargets ( ) , key = operator . attrgetter ( 'PRIORITY' ) , reverse = True ) for handler in target_clses : target = handler . Build ( target_name ) if target : if not target . valid : print 'Invalid target {0} as {1}' . format ( target_name , target . build_target ) guesses = cr . Builder . GuessTargets ( target_name ) if guesses : print 'Did you mean {0}?' . format ( ', ' . join ( guesses [ : - 1 ] ) + ' or ' + guesses [ - 1 ] if len ( guesses ) > 1 else guesses [ 0 ] ) exit ( 1 ) return target print 'Unknown target {0}' . format ( target_name ) exit ( 1 )