def METHOD_NAME(resource_name, ip):
    from azure.mgmt.media.models import IPRange
    subnet_prefix_length = None
    try:
        if '/' in ip:
            ipSplit = ip.split('/')
            ip = ipSplit[0]
            subnet_prefix_length = ipSplit[1]
    except ValueError:
        pass
    return IPRange(name=("{}_{}".format(resource_name, ip)), address=ip, subnet_prefix_length=subnet_prefix_length)