def METHOD_NAME(
    memory_limit: Optional[str] = None,
    cpu_limit: Optional[str] = None,
    memory_request: Optional[str] = None,
    cpu_request: Optional[str] = None,
):
    """Add default resource requests and limits.
    For resource units, refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes.
    Args:
      memory_limit: optional, memory limit. Format can be 512Mi, 2Gi etc.
      cpu_limit: optional, cpu limit. Format can be 0.5, 500m etc.
      memory_request: optional, defaults to memory limit.
      cpu_request: optional, defaults to cpu limit.
    """
    if not memory_request:
        memory_request = memory_limit
    if not cpu_request:
        cpu_request = cpu_limit
    def _add_default_resource_spec(task):
        # Skip tasks which are not container ops.
        if not isinstance(task, dsl.ContainerOp):
            return task
        _apply_default_resource(task, 'cpu', cpu_request, cpu_limit)
        _apply_default_resource(task, 'memory', memory_request, memory_limit)
        return task
    return _add_default_resource_spec