# Buggy code
def _check_if_in_local_vm(self, runner: Runner) -> bool:
    # Minikube just has 'minikube' as context'
    if self.context == "minikube":
        return True
    # Minishift has complex context name, so check by server:
    if self.command == "oc":
        try:
            ip = runner.get_output(["minishift", "ip"]).strip()
        except (OSError, CalledProcessError):
            return False
        if ip and ip in self.server:
            return True
    return False


# Traceback (twisted.names.error.DomainError)
92.8  18 | 2018-08-14T20:54:25+0000 [stdout#info] Failed to lookup b'safebrowsing.googleapis.com' due to [Failure instance: Traceback (failure with no frames): <class 'twisted.names.error.DomainError'>: [Errno -2] Name does not resolve
92.8  18 | 2018-08-14T20:54:25+0000 [stdout#info] ], falling back to b'safebrowsing.googleapis.com.wework.com'
92.9  18 | 2018-08-14T20:54:25+0000 [-] DNSDatagramProtocol starting on 20818
92.9  18 | 2018-08-14T20:54:25+0000 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x7fb83282fb38>
92.9  18 | 2018-08-14T20:54:25+0000 [-] (UDP Port 7796 Closed)
92.9  18 | 2018-08-14T20:54:25+0000 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x7fb8327ef208>
93.2  18 | 2018-08-14T20:54:25+0000 [stdout#info] getaddrinfo error: [Errno -3] Try again
93.2  18 | 2018-08-14T20:54:25+0000 [stdout#info] getaddrinfo error: [Errno -2] Name does not resolve
95.9  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
95.9  18 | 	Traceback (most recent call last):
95.9  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
95.9  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] Unhandled Error
96.0  18 | 	Traceback (most recent call last):
96.0  18 | 	Failure: twisted.internet.defer.TimeoutError: [Query('assets-cdn.github.com.wework.com', 1, 1)]
96.0  18 |
96.0  18 | 2018-08-14T20:54:28+0000 [-] (UDP Port 61835 Closed)
96.0  18 | 2018-08-14T20:54:28+0000 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x7fb832841860>
97.7  25 | c : DNS request from ('10.65.108.0', 24811) to None: 45 bytes
97.7  18 | 2018-08-14T20:54:29+0000 [stdout#info] A query: b'safebrowsing.googleapis.com'
97.8  18 | 2018-08-14T20:54:30+0000 [stdout#info] getaddrinfo error: [Errno -2] Name does not resolve
97.8  25 | c : DNS request from ('10.65.108.0', 55676) to None: 56 bytes
97.8  18 | 2018-08-14T20:54:30+0000 [stdout#info] Updated query of type 1 from b'safebrowsing.googleapis.com.wework.com' to b'safebrowsing.googleapis.com'
97.8  18 | 2018-08-14T20:54:30+0000 [stdout#info] A query: b'safebrowsing.googleapis.com'
97.8  18 | 2018-08-14T20:54:30+0000 [stdout#info] getaddrinfo error: [Errno -2] Name does not resolve
97.8  18 | 2018-08-14T20:54:30+0000 [stdout#info] Failed to lookup b'safebrowsing.googleapis.com' due to [Failure instance: Traceback (failure with no frames): <class 'twisted.names.error.DomainError'>: [Errno -2] Name does not resolve
97.9  18 | 2018-08-14T20:54:30+0000 [stdout#info] ], falling back to b'safebrowsing.googleapis.com.wework.com'
100.8  25 | c : DNS request from ('10.65.108.0', 37037) to None: 27 bytes
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] A query: b'ide.c9.io'
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] getaddrinfo error: [Errno -2] Name does not resolve
100.8  25 | c : DNS request from ('10.65.108.0', 55315) to None: 38 bytes
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] Updated query of type 1 from b'ide.c9.io.wework.com' to b'ide.c9.io'
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] A query: b'ide.c9.io'
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] getaddrinfo error: [Errno -2] Name does not resolve
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] Failed to lookup b'ide.c9.io' due to [Failure instance: Traceback (failure with no frames): <class 'twisted.names.error.DomainError'>: [Errno -2] Name does not resolve
100.8  18 | 2018-08-14T20:54:33+0000 [stdout#info] ], falling back to b'ide.c9.io.wework.com'
102.8  25 | c : DNS request from ('10.65.108.0', 44676) to None: 56 bytes
102.8  18 | 2018-08-14T20:54:35+0000 [stdout#info] Updated query of type 1 from b'safebrowsing.googleapis.com.wework.com' to b'safebrowsing.googleapis.com'
102.8  18 | 2018-08-14T20:54:35+0000 [stdout#info] A query: b'safebrowsing.googleapis.com'
102.9  18 | 2018-08-14T20:54:35+0000 [stdout#info] getaddrinfo error: [Errno -2] Name does not resolve
102.9  18 | 2018-08-14T20:54:35+0000 [stdout#info] Failed to lookup b'safebrowsing.googleapis.com' due to [Failure instance: Traceback (failure with no frames): <class 'twisted.names.error.DomainError'>: [Errno -2] Name does not resolve
102.9  18 | 2018-08-14T20:54:35+0000 [stdout#info] ], falling back to b'safebrowsing.googleapis.com.wework.com'

# Fixed code
def _check_if_in_local_vm(self, runner: Runner) -> bool:
    # Running Docker Desktop on macOS (or maybe Windows?)
    if self.context == "docker-for-desktop":
        return True
    # Minikube just has 'minikube' as context'
    if self.context == "minikube":
        return True
    # Minishift has complex context name, so check by server:
    if self.command == "oc":
        try:
            ip = runner.get_output(["minishift", "ip"]).strip()
        except (OSError, CalledProcessError):
            return False
        if ip and ip in self.server:
            return True
    return False