def format_ipv4(value: int) -> str: """Dotted-quad text for an unsigned 32-bit address: the inverse of parse_ipv4.""" if isinstance(value, bool) or not isinstance(value, int) or value < 0 or value > 4294967295: raise ValueError("IPv4 value must be an integer from 0 to 4294967295, received %r" % (value,)) return "%d.%d.%d.%d" % ((value >> 24) & 255, (value >> 16) & 255, (value >> 8) & 255, value & 255)