Microbial fuel cells and microbial electrolysis cells for the production of bioelectricity and biomaterials