<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_user_threaded_json(pjson):
 """Takes a parsed JSON dict representing a set of tests in the user-threaded format and validates it."""

        tests = pjson["tests"]

        # Verify that 'tests' is a two dimensional list
        is_2d_list = lambda ls: len(ls) == len(filter(lambda l: type(l) is list, ls))
        if type(tests) is not list or not is_2d_list(tests):
            raise ParseError("'tests' should be a two-dimensional list of strings when '--user-defined-threads' is present.")

        # Verify that 'tests' sub-lists are of strings
        for sublist in tests:
            for test in sublist:
                if type(test) is not unicode:
                    raise TypeError(
                        "Expected a unicode string but got %s. 'tests' should be a two-dimensional list of strings when '--user-defined-threads is present.'" 
                        % test
                    )

        # Verify that 'environments' key is not present
        try:
            pjson["environments"]
            raise ParseError("'environments' list is not allowed when --user-defined-threads is present.")
        except KeyError: pass