Bioelectrochemical systems for energy recovery from wastewater