<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def verify(token, key, algorithms, verify=True):
 """Verifies a JWS string's signature. Args: token (str):
 A signed JWS to be verified. key (str or dict):
 A key to attempt to verify the payload with. Can be individual JWK or JWK set. algorithms (str or list):
 Valid algorithms that should be used to verify the JWS. Returns: str: The str representation of the payload, assuming the signature is valid. Raises: JWSError: If there is an exception verifying a token. Examples: """


    header, payload, signing_input, signature = _load(token)

    if verify:
        _verify_signature(signing_input, header, signature, key, algorithms)

    return payload