def _IsMap(message, field):
    """Returns whether the "field" is actually a map-type."""
    value = message.get_assigned_value(field.name)
    if not isinstance(value, messages.Message):
        return False
    try:
        additional_properties = value.field_by_name('additionalProperties')
    except KeyError:
        return False
    else:
        return additional_properties.repeated
Returns whether the "field" is actually a map-type.