def get_command_name(cmd, default=''):
    """Extracts command name."""
    # Check if command object exists.
    # Return the expected name property or replace with default.
    if cmd:
        return cmd.name
    return default