'Standard method to try to auto-detect the device type. This method will be called for each
device_type present in SSH_MAPPER_BASE dict (\'dispatch\' key). It will attempt to send a
command and match some regular expression from the ouput for each entry in SSH_MAPPER_BASE
(\'cmd\' and \'search_pattern\' keys).
Parameters
cmd : str
The command to send to the remote device after checking cache.
search_patterns : list
A list of regular expression to look for in the command\'s output (default: None).
re_flags: re.flags, optional
Any flags from the python re module to modify the regular expression (default: re.I).
priority: int, optional
The confidence the match is right between 0 and 99 (default: 99).'

def _autodetect_std(self, cmd=u'', search_patterns=None, re_flags=re.I, priority=99):

    invalid_responses = [u'%    Invalid    input    detected', u'syntax    error,    expecting', u'Error:    Unrecognized    command', u'%Error']
    if ((not cmd) or (not search_patterns)):
        return 0
    try:
        response = self._send_command_wrapper(cmd)
        for pattern in invalid_responses:
            match = re.search(pattern, response, flags=re.I)
            if match:
                return 0
        for pattern in search_patterns:
            match = re.search(pattern, response, flags=re_flags)
            if match:
                return priority
    except Exception:
        return 0
    return 0
