def accept(source_port, destination_port, protocol, raw_addresses):
    '''
    accepts comma separated addresses or list of addresses
    '''

    protocol = protocol or 'tcp'

    if not isinstance(raw_addresses, list):
        raw_addresses = [raw_addresses]

    addresses = []
    for a in raw_addresses:
        if a is None:
            addresses.append(None)
        else:
            addresses += a.split(',')

    rules = []
    for address in addresses:
        parts = ['-A', CHAIN]

        if address:
            address, _, mask = address.partition('/')
            mask = mask or '32'
            parts.append('-s %s/%s' % (address, mask))

        if source_port:
            parts.append('-p %s -m %s --sport %s' % (protocol, protocol, source_port))

        if destination_port:
            parts.append('-p %s -m %s --dport %s' % (protocol, protocol, destination_port))

        parts += ['-j', 'RETURN']

        rules.append(' '.join(parts))

    return rules
accepts comma separated addresses or list of addresses