Improve 'devicematch' in tools/device.py

At the moment, the device matching is hardcoded.
Maybe there’s a simple framework for this job.
Otherwise, the if/else structure should be somehow improved.

(from redmine: issue id 740, created on 2011-11-20 by root, closed on 2011-11-21)