'connected(direction = \'any\') -> bool
Returns True if the tube is connected in the specified direction.
Arguments:
direction(str): Can be the string \'any\', \'in\', \'read\', \'recv\',
\'out\', \'write\', \'send\'.
Doctest:
>>> def p(x): print x
>>> t = tube()
>>> t.connected_raw = p
>>> _=map(t.connected, (\'any\', \'in\', \'read\', \'recv\', \'out\', \'write\', \'send\'))
any
recv
recv
recv
send
send
send
>>> t.connected(\'bad_value\') #doctest: +ELLIPSIS
Traceback (most recent call last):
KeyError: "direction must be in [\'any\', \'in\', \'out\', \'read\', \'recv\', \'send\', \'write\']"'

def connected(self, direction='any'):

    try:
        direction = self.connected_directions[direction]
    except KeyError:
        raise KeyError(('direction    must    be    in    %r' % sorted(self.connected_directions)))
    else:
        return self.connected_raw(direction)
