def field2nullable(field, **kwargs):
    """Return the dictionary of swagger field attributes for a nullable field.

    :param Field field: A marshmallow field.
    :rtype: dict
    """
    attributes = {}
    if field.allow_none:
        omv = kwargs['openapi_major_version']
        attributes['x-nullable' if omv < 3 else 'nullable'] = True
    return attributes