# Buggy code
def validate_api_key(self) -> Tuple[bool, str]:
    try:
        # We know account endpoint returns a dict
        self.api_query_dict("account")
    except RemoteError as e:
        error = str(e)
        if "API-key format invalid" in error:
            return False, "Provided API Key is in invalid Format"
        elif "Signature for this request is not valid" in error:
            return False, "Provided API Secret is malformed"
        elif "Invalid API-key, IP, or permissions for action" in error:
            return False, "API Key does not match the given secret"
        else:
            raise
    return True, ""


# Traceback (rotkehlchen.errors.RemoteError)
[16/09/2020 17:41:40 Mitteleuropäische Sommerzeit] rotkehlchen.exchanges.binance: Binance API request request_url=https://api.binance.com/api/v3/account?recvWindow=10000&amp;timestamp=1600270900071&amp;signature=[REDACTED]
[16/09/2020 17:41:40 Mitteleuropäische Sommerzeit] rotkehlchen.api.server: Exception on /api/1/exchanges [PUT]
Traceback (most recent call last):
File "site-packages\flask\app.py", line 1949, in full_dispatch_request
File "site-packages\flask\app.py", line 1935, in dispatch_request
File "site-packages\flask_restful\__init__.py", line 458, in wrapper
File "site-packages\flask\views.py", line 89, in view
File "site-packages\flask_restful\__init__.py", line 573, in dispatch_request
File "site-packages\webargs\core.py", line 366, in wrapper
File "rotkehlchen\api\v1\resources.py", line 197, in put
File "rotkehlchen\api\rest.py", line 125, in wrapper
File "rotkehlchen\api\rest.py", line 393, in setup_exchange
File "rotkehlchen\rotkehlchen.py", line 810, in setup_exchange
File "rotkehlchen\exchanges\manager.py", line 94, in setup_exchange
File "rotkehlchen\exchanges\binance.py", line 204, in validate_api_key
File "rotkehlchen\exchanges\binance.py", line 295, in api_query_dict
File "rotkehlchen\exchanges\binance.py", line 273, in api_query
rotkehlchen.errors.RemoteError: Binance API request https://api.binance.com/api/v3/account?recvWindow=10000&amp;timestamp=1600270900071&amp;signature=[SIGNATURE] for account failed with HTTP status code: 400, error code: -1021 and error message: Timestamp for this request was 1000ms ahead of the server's time.
[16/09/2020 17:41:40 Mitteleuropäische Sommerzeit] rotkehlchen.api.server.pywsgi: 127.0.0.1 - - "PUT /api/1/exchanges HTTP/1.1" 500 216 0.373099
[16/09/2020 17:41:43 Mitteleuropäische Sommerzeit] rotkehlchen.api.rest: Request successful response={"result": {"warnings": [], "errors": []}, "message": ""}, status_code=200

# Fixed code
def validate_api_key(self) -> Tuple[bool, str]:
    try:
        # We know account endpoint returns a dict
        self.api_query_dict("account")
    except RemoteError as e:
        error = str(e)
        if "API-key format invalid" in error:
            return False, "Provided API Key is in invalid Format"
        elif "Signature for this request is not valid" in error:
            return False, "Provided API Secret is malformed"
        elif "Invalid API-key, IP, or permissions for action" in error:
            return False, "API Key does not match the given secret"
        elif "Timestamp for this request was" in error:
            return False, (
                "Local system clock is not in sync with binance server. "
                "Try syncing your system's clock"
            )
        else:
            raise
    return True, ""