<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_team_exists(team):
 """ Check that the team registry actually exists. """

    if team is None:
        return

    hostname = urlparse(get_registry_url(team)).hostname
    try:
        socket.gethostbyname(hostname)
    except IOError:
        try:
            # Do we have internet?
            socket.gethostbyname('quiltdata.com')
        except IOError:
            message = "Can't find quiltdata.com. Check your internet connection."
        else:
            message = "Unable to connect to registry. Is the team name %r correct?" % team
        raise CommandException(message)