from netaddr import IPNetwork


def generate_netacl(source, default=[]):
    """
    Generates IP ACL

    Doesn't work with IPv6

    Args:
        source: string with IP/network or iterable
        default: returns if source is empty
    """
    if source:
        return [
            IPNetwork(h)
            for h in ([source] if isinstance(source, str) else source)
        ]
    else:
        return default