<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ip_v4(self, with_port: bool = False) -> str: """Generate a random IPv4 address. :param with_port: Add port to IP. :return: Random IPv4 address. :Example: 19.121.223.58 """

        ip = '.'.join(str(self.random.randint(0, 255)) for _ in range(4))

        if with_port:
            ip += ':{}'.format(self.port())

        return ip