def _successful(response):
    """ Returns whether a response was considered successful. If no body is
    available or the 'meta' dict in the response envelope doesn't contain a
    'code' value, checks the HTTP response code instead.

    :param requests.Response response: a response object
    :returns: (boolean) True if successful

    """
    code = response.status_code

    try:
        code = response.json()['meta']['code']
    except Exception:
        pass

    return code in (200, 201, 202)