code: def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):
      
      external_id = None
      for pattern_type, pattern in EXTERNAL_ID_PATTERNS:
          if type != EXTERNAL_ID_TYPE_ANY and type != pattern_type:
              continue
  
          match = search(pattern, output)
          if match:
              external_id = match.group(1)
              break
  
      return external_id
docs: Attempt to parse the output of job submission commands for an external id.__doc__
  
      >>> parse_external_id("12345.pbsmanager")
      '12345.pbsmanager'
      >>> parse_external_id('Submitted batch job 185')
      '185'
      >>> parse_external_id('Submitted batch job 185', type='torque')
      'Submitted batch job 185'
      >>> parse_external_id('submitted to cluster 125.')
      '125'
      >>> parse_external_id('submitted to cluster 125.', type='slurm')
      >>>