def checkanswer(response, correct_code, json):
    """Takes API response and checks if the response is correct.
    Appends value 'API_status' to answer indicating if response correct or not
    :param response: requests; response returned by API calls
    :param correct_code: int, result code for no errors
    :return dict; coverted json of answer (if correct) and 'API_status'
    """
    if response.status_code != correct_code:
        return {'API_status': False, 'error_code': response.status_code}
    elif json:
        return {'response': response.json(), 'API_status': True}
    else:
        return {'API_status': True}