Dopants and defects: the local structure and dynamics of proton-conducting perovskites