normalize_ip_address

gafaelfawr.util.normalize_ip_address(v)

Pydantic validator for IP address fields.

Convert the PostgreSQL INET type to str to support reading entries from a PostgreSQL database.

Parameters:

v (str | IPv4Address | IPv6Address | None) – The field representing an IP address.

Returns:

The converted IP address.

Return type:

str or None