We all know dogs are man's best friend - but it turns out they can do a lot more than provide us with companionship.