def generate_checks(container, address, check_ports):
    """Generates the check dictionary to pass to consul of the form {'checks': []}"""
    checks = {}
    checks['checks'] = []
    for p in check_ports:
        checks['checks'].append(
            {'id': '{}-port{}'.format(container, p),
             'name': 'Check TCP port {}'.format(p),
             'tcp': '{}:{}'.format(address, p),
             'Interval': '30s',
             'timeout': '4s'})
    return checks