def _GetStepLogViewUrl(build, full_step_name, log_name, partial_match=False):
  """Gets view url of the requested log.

  Args:
    build (buildbucket_proto.build_pb2.Build proto): Information about a build.
    full_step_name (str): Full name of the step.
    log_name (str): Type of the log.
    partial_match (bool): If the step_name is not found among the steps in the
      builder, allow the function to retrieve the step log for a step whose name
      contains step_name as a prefix.

  Returns:
    (str): view_url of the requested log.
  """
  for step in build.steps or []:
    if step.name == full_step_name:
      for log in step.logs or []:
        if log.name.lower() == log_name:
          return log.view_url

  if partial_match:
    for step in build.steps or []:
      if step.name.startswith(full_step_name):
        for log in step.logs or []:
          if log.name.lower() == log_name:
            return log.view_url

  return None