parameters: (bundle_identifier, required)
return_statement: return max(
        valid_provisioning_profiles,
        key=lambda p: len(p.application_identifier_pattern))
docstring: Finds mobile provisioning profile to use to sign bundle.
  
    Args:
      bundle_identifier: the identifier of the bundle to sign.
  
    Returns:
      The ProvisioningProfile object that can be used to sign the Bundle
      object or None if no matching provisioning profile was found.
docstring_summary: Finds mobile provisioning profile to use to sign bundle.
docstring_tokens: Finds mobile provisioning profile to use to sign bundle .
function: def FindProvisioningProfile(bundle_identifier, required):
    """Finds mobile provisioning profile to use to sign bundle.
  
    Args:
      bundle_identifier: the identifier of the bundle to sign.
  
    Returns:
      The ProvisioningProfile object that can be used to sign the Bundle
      object or None if no matching provisioning profile was found.
    """
    provisioning_profile_paths = glob.glob(
        os.path.join(GetProvisioningProfilesDir(), '*.mobileprovision'))
  
    # Iterate over all installed mobile provisioning profiles and filter those
    # that can be used to sign the bundle.
    valid_provisioning_profiles = []
    for provisioning_profile_path in provisioning_profile_paths:
      provisioning_profile = ProvisioningProfile(provisioning_profile_path)
      if provisioning_profile.ValidToSignBundle(bundle_identifier):
        valid_provisioning_profiles.append(provisioning_profile)
  
    if not valid_provisioning_profiles:
      if required:
        sys.stderr.write(
            'No mobile provisioning profile found for "%s".\n' %
            bundle_identifier)
        sys.exit(1)
      return None
  
    # Select the most specific mobile provisioning profile, i.e. the one with
    # the longest application identifier pattern.
    return max(
        valid_provisioning_profiles,
        key=lambda p: len(p.application_identifier_pattern))
function_tokens: def FindProvisioningProfile ( bundle_identifier , required ) : provisioning_profile_paths = glob . glob ( os . path . join ( GetProvisioningProfilesDir ( ) , '*.mobileprovision' ) ) # Iterate over all installed mobile provisioning profiles and filter those # that can be used to sign the bundle. valid_provisioning_profiles = [ ] for provisioning_profile_path in provisioning_profile_paths : provisioning_profile = ProvisioningProfile ( provisioning_profile_path ) if provisioning_profile . ValidToSignBundle ( bundle_identifier ) : valid_provisioning_profiles . append ( provisioning_profile ) if not valid_provisioning_profiles : if required : sys . stderr . write ( 'No mobile provisioning profile found for "%s".\n' % bundle_identifier ) sys . exit ( 1 ) return None # Select the most specific mobile provisioning profile, i.e. the one with # the longest application identifier pattern. return max ( valid_provisioning_profiles , key = lambda p : len ( p . application_identifier_pattern ) )