Self-doped carbon architectures with heteroatoms containing nitrogen, oxygen and sulfur as high-performance anodes for lithium- and sodium-ion batteries