import ast


def valid_check(code):
    """Performs a check to ensure that the code provided by the user is syntactically correct.

    :param code: Source code string block.
    :type code: str
    :returns: True is successfully compiled, False otherwise.

    """
    try:
        node = ast.parse(code)
        # print(ast.dump(node))
    except SyntaxError:
        return False
    return True