Add API + tests for Swarm

the indentation is not PEP8 compliant