I think it might be clearer to instantiate an empty dict if not headers in its own variable above rather than in the function call.