This "thing" was inspired by Mobilow's accu caps (http://www.thingiverse.com/thing:115711), since I also always carry spare batteries with me - for my camera, my eTrex, my MP3, ...
The challenge was to find a design that a) would firmly hold all batteries of the same type, even if they are a tiny bit larger or smaller than the norm value, and b) that would be easily customizable for different battery types and an arbitrary MxN array of battery cells.
The solution to the first problem was to add flexible "friction winglets" between the cells, which result in a firm grip of the battery cells over a reasonable variation in diameters. This way I can carry the "capped" batteries in my pocket all day without any fear that the caps will fall off by accident.
The needed configurability is built into the .scad file, which contains a generic module CellCaps() and for each type of batteries a small module which calls CellCaps() with the corresponding size parameters.
Normally, two identical caps are used to safely store and transport a set of batteries. However, single larger arrays (e.g. 6x4 AAs) can also be used as storage trays.
The .stl files provided are for the standards AA, AAA batteries, as well as for the 18650 Li-Ion/Li-Po cells.
For each type I have included linear 2x, 3x , 4x arrays as well as a 2x2-array. But it's straight forward to adapt the .scad file for any other cylindrical cell type or array layout.
Update 2014-09-09: If you are looking for a battery holder to provide battery power to some electronic project, check out my flexing battery holder with integrated spring.
I printed my battery caps in ABS (because of the better elasticity of the winglets) on my RepRap using H=.35mm/W=.56mm layers.
If you want to rebuild a particular .stl file from the .scad file, make sure to uncomment the corresponding module call at the end of the file.