<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_callable(self, func, *targets):
 """ If func is already a callable, it is returned directly. If it's a string, it is assumed to be a method on one of the objects supplied in targets and that is returned. If no method with the specified name is found, an AttributeError is raised. :param func: Callable or name of method on one object in targets. :param targets: List of targets with decreasing priority for finding func. :return: Callable. """

        if not callable(func):
            func_name = func
            func = next((getattr(obj, func, None) for obj in targets if func in dir(obj)),
                        None)

            if not func:
                raise AttributeError(
                    'No method with the name \'{}\' could be found on any of the target objects '
                    '(device, interface). Please check the spelling.'.format(func_name))

        return func