def isSignatureValid(expected, received):
    """
    Verifies that the received signature matches the expected value
    """
    if expected:
        if not received or expected != received:
            return False
    else:
        if received:
            return False
    return True
Verifies that the received signature matches the expected value