In the heat of the moment I didn't remember Python already had this.