In ```qiime.util```, there is a ```MetadataMap``` object that you might want to use.  There is a static method ```MetadataMap.parseMetadataMap``` that you can use instead of rolling your own