def __is_function_action(self, action_function):
<EOL>is_function_action = True<EOL>if not hasattr(action_function, '<STR_LIT>'):<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>for end_string, context in action_function():<EOL><INDENT>if not isinstance(end_string, basestring):<EOL><INDENT>self.log_error("<STR_LIT>")<EOL><DEDENT>if not isinstance(context, dict):<EOL><INDENT>self.log_error("<STR_LIT>")<EOL><DEDENT>break<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>is_function_action = False<EOL><DEDENT>return is_function_action<EOL>
Detect if given function is really an action function.

Args:
    action_function: Function to test.

Note:
    We don't care if the variable refer to a function but rather if it is callable or not.