<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def DictToAdditionalPropertyMessage(properties, additional_property_type, sort_items=False):
 """Convert the given dictionary to an AdditionalProperty message."""

    items = properties.items()
    if sort_items:
        items = sorted(items)
    map_ = []
    for key, value in items:
        map_.append(additional_property_type.AdditionalProperty(
            key=key, value=value))
    return additional_property_type(additionalProperties=map_)