You cannot create a swarm with a resource as both a producer and a consumer using swarms.py. The resources are specified as a map where the resource is the key and "producer" or "consumer" is the value. Since it is a map you cannot specify the same resource twice.
It would be nice if there was a way of specifying that a resource could be both a producer and a consumer.
Resources can be made producers and consumers after the swarm is created, so this isn't a high priority.