<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_tool(command):
 """ Checks that a tool can be invoked by 'command'. If command is not an absolute path, checks if it can be found in 'path'. If comand is absolute path, check that it exists. Returns 'command' if ok and empty string otherwise. """

    assert is_iterable_typed(command, basestring)
    #FIXME: why do we check the first and last elements????
    if check_tool_aux(command[0]) or check_tool_aux(command[-1]):
        return command