handling empty messages

A message with a required field whose type is a message of all optional fields could be `{'required': {}}`

`dict_to_protobuf` ignores the `{}` and removes the `required` field from the message which causes an error at serialization time.

The PR contains the tests and one way to fix the problem.