'formats rsync rsh target, escaping ipv6 addresses if needed'

def _format_rsync_rsh_target(self, host, path, user):

    user_prefix = ''
    if path.startswith('rsync://'):
        return path
    if ((self._remote_transport not in ['docker']) and user):
        user_prefix = ('%s@' % (user,))
    if self._host_is_ipv6_address(host):
        return ('[%s%s]:%s' % (user_prefix, host, path))
    else:
        return ('%s%s:%s' % (user_prefix, host, path))
