"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 16:46:03.757739
"""

```python
class FallbackExecutor:
    """
    A class for executing a task with fallback mechanisms in case of errors.
    
    :param function: The main function to execute
    :type function: callable
    :param fallback_function: The function to use as a fallback, defaults to None
    :type fallback_function: callable, optional
    """

    def __init__(self, function: callable, fallback_function: callable = None):
        self.function = function
        self.fallback_function = fallback_function

    def execute(self) -> any:
        """
        Execute the main function or fall back to the secondary function if an error occurs.
        
        :return: The result of the executed function or fallback function
        :rtype: Any
        """
        try:
            return self.function()
        except Exception as e:
            print(f"An error occurred: {e}")
            if self.fallback_function is not None:
                return self.fallback_function()
            else:
                raise

# Example usage
def main_task():
    # Simulate a task that might fail
    import random
    if random.choice([True, False]):
        print("Task executed successfully")
    else:
        raise ValueError("Simulated failure")

def fallback_task():
    print("Executing fallback task")

executor = FallbackExecutor(main_task, fallback_function=fallback_task)
result = executor.execute()
print(f"Result: {result}")
```