Add API + tests for Swarm

The indentation is not PEP8 compliant