code: def from_dict(data, require=None):
      
      keys_needed = set(require if require is not None else [])
  
      missing = keys_needed.difference(six.iterkeys(data))
  
      if missing:
          raise ValueError(
              'Service account info was not in the expected format, missing '
              'fields {}.'.format(', '.join(missing)))
  
      # Create a signer.
      signer = crypt.RSASigner.from_service_account_info(data)
  
      return signer
docs: Validates a dictionary containing Google service account data.
  
      Creates and returns a :class:`google.auth.crypt.Signer` instance from the
      private key specified in the data.
  
      Args:
          data (Mapping[str, str]): The service account data
          require (Sequence[str]): List of keys required to be present in the
              info.
  
      Returns:
          google.auth.crypt.Signer: A signer created from the private key in the
              service account file.
  
      Raises:
          ValueError: if the data was in the wrong format, or if one of the
              required keys is missing.