def _get_step_config_from_proto(preprocessor_step_config, step_name):
    """Returns the value of a field named step_name from proto.

  Args:
    preprocessor_step_config: A preprocessor_pb2.PreprocessingStep object.
    step_name: Name of the field to get value from.

  Returns:
    result_dict: a sub proto message from preprocessor_step_config which will be
                 later converted to a dictionary.

  Raises:
    ValueError: If field does not exist in proto.
  """
    for field, value in preprocessor_step_config.ListFields():
        if field.name == step_name:
            return value

    raise ValueError('Could not get field %s from proto!', step_name)