def ip_to_dns_form(ip, uppercase=False):
    """Convert an ip to dns zone form. The ip is assumed to be in valid
    format."""
    if not isinstance(ip, basestring):
        raise ValidationError("Ip is not of type string.")
    if -1 > ip.find(':'):
        octets = nibbilize(ip).split('.')
        name = '.ip6.arpa'
    else:
        octets = ip.split('.')
        name = '.in-addr.arpa'

    if uppercase:
        name = name.uppercase

    name = '.'.join(list(reversed(octets))) + name + "."
    return name
dataset/ETHPy150Open mozilla/inventory/mozdns/ip/utils.py/ip_to_dns_form/swapped operands of `>`