def build_result_string(port, target, should_be_blocked, was_blocked):
    """
    Builds and returns a test result string
    """
    was_successful = should_be_blocked == was_blocked
    title = 'Test %s:%s%s%s' % (target, '-' if should_be_blocked else '',
        port, ' succeeded' if was_successful else ' failed')
    details = (
        'Could%s reach %s on port %s. Expected target to %sbe reachable' %
        ("n't" if was_blocked else '', target, port, 'not ' if
        should_be_blocked else ''))
    return '%s\n%s' % (title, details)
