python update dictionary inside function