"""Create recovery_planner
Generated by Phi-Octopus Eden
2025-11-08 11:43:35.003697
"""

```python
from typing import List, Optional


class RecoveryPlanner:
    """
    A class for creating a limited error recovery planner that helps in handling errors gracefully.

    Attributes:
        max_attempts (int): The maximum number of attempts before giving up.
        current_attempt (int): The current attempt count.
        recovery_steps (List[str]): A list of steps to be taken when an error occurs.
    """

    def __init__(self, max_attempts: int = 3):
        self.max_attempts = max_attempts
        self.current_attempt = 0
        self.recovery_steps = []

    def add_recovery_step(self, step: str) -> None:
        """
        Add a recovery step to the planner.

        Args:
            step (str): The step to be added.
        """
        self.recovery_steps.append(step)

    def handle_error(self, error_message: Optional[str] = None) -> bool:
        """
        Handle an error by executing the next recovery step and updating the attempt count.

        Args:
            error_message (Optional[str]): An optional message for logging or debugging purposes.

        Returns:
            bool: True if successful in recovering, False if max attempts reached.
        """
        self.current_attempt += 1
        if self.current_attempt > self.max_attempts:
            print(f"Max attempts reached: {self.max_attempts}. Giving up.")
            return False

        if not self.recovery_steps:
            print("No recovery steps defined. Error not handled.")
            return False

        next_step = self.recovery_steps.pop(0)
        print(f"Executing recovery step: {next_step}")

        # Simulate an attempt and check for success
        success = next_step == "backup_data"
        if success:
            print("Error recovered successfully!")
            return True

        else:
            print("Recovery failed, trying the next step...")
            self.add_recovery_step(next_step)  # Add back the failed step to be tried again later
            return False


# Example usage
recovery_plan = RecoveryPlanner()
recovery_plan.add_recovery_step("log_error")
recovery_plan.add_recovery_step("backup_data")
recovery_plan.add_recovery_step("restart_service")

result = recovery_plan.handle_error()  # Simulate an error

if not result:
    print("Unable to recover. Shutting down.")
```

This code defines a `RecoveryPlanner` class that helps manage limited error recovery by adding steps and attempting them in sequence until either success or the maximum number of attempts is reached. The example usage demonstrates how to use this class to add steps and handle errors.