import re


def check_parentheses(expression):
    """Check parentheses for mismatch

    Receive a candidate expression as a string and return True if all
    parentheses are properly matched. Nesting is allowed. If an error is
    detected, return False. If no parentheses are present, return True.
    """

    # disallow paired parentheses containing only space and/or
    # operator(s) or nothing at all
    if re.search(r'\([\s+*/-]*\)', expression):
        return False

    # construct a list of parentheses to check
    parentheses = re.findall(r'[()]', expression)

    #  parity
    count = 0
    counter = {
        '(': 1,
        ')': -1
    }

    for parenthesis in parentheses:
        count += counter[parenthesis]

        # if left of any point there is more closed than opened parentheses
        if count < 0:
            return False

    # if after counting through the entire expression
    # there is more opened than closed parentheses (count > 0)
    if count:
        return False

    return True