def check_status(r):
    """
    Helper function to check the request status.
    We consider everything except 200 and 201 as an error in this example.
    """
    code = r.status_code

    error = None
    if code not in [200, 201]:
        error = True

    return error