1) Proper doc string is missing. 
2) this should live inside utils or so.