code: def str_to_hostentry(entry):
          
          line_parts = entry.strip().split()
          if is_ipv4(line_parts[0]) and valid_hostnames(line_parts[1:]):
              return HostsEntry(entry_type='ipv4',
                                address=line_parts[0],
                                names=line_parts[1:])
          elif is_ipv6(line_parts[0]) and valid_hostnames(line_parts[1:]):
              return HostsEntry(entry_type='ipv6',
                                address=line_parts[0],
                                names=line_parts[1:])
          else:
              return False
docs: Transform a line from a hosts file into an instance of HostsEntry
          :param entry: A line from the hosts file
          :return: An instance of HostsEntry