def _match_names(pattern, names):
 result = []
 for name in names:
  match = pattern.match(name)
  if match:
   result.append((name, match.group('name')))
 return result

def _match_names ( pattern , names ) : result = [ ] for name in names : match = pattern . match ( name ) if match : result . append ( ( name , match . group ( 'name' ) ) ) return result
match names to patterns and return a tuple of matching name with extracted value .