# Buggy code
def deployment_validate_table_format(result):
    from collections import OrderedDict

    if result.get("error", None):
        error_result = OrderedDict()
        error_result["result"] = result["error"]["code"]
        try:
            tracking_id = re.match(
                r".*(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})", str(result["error"]["message"])
            ).group(1)
            error_result["trackingId"] = tracking_id
        except:  # pylint: disable=bare-except
            pass
        try:
            error_result["message"] = result["error"]["details"][0]["message"]
        except:  # pylint: disable=bare-except
            error_result["message"] = result["error"]["message"]
        return error_result
    elif result.get("properties", None):
        success_result = OrderedDict()
        success_result["result"] = result["properties"]["provisioningState"]
        success_result["correlationId"] = result["properties"]["correlationId"]
        return success_result
    return result


# Traceback (FileNotFoundError)
(env) C:\Users\trpresco\Documents\github\azure-cli>run_tests --module network --parallel
The run_tests command is going to be replaced by 'azdev test' command.

Traceback (most recent call last):
File "C:\Users\trpresco\Documents\github\azure-cli\env\Scripts\run_tests-script.py", line 11, in <module>
load_entry_point('azure-cli-dev-tools', 'console_scripts', 'run_tests')()
File "c:\users\trpresco\documents\github\azure-cli\tools\automation\tests\__init__.py", line 79, in legacy_entry_point
args.func(args)
File "c:\users\trpresco\documents\github\azure-cli\tools\automation\tests\__init__.py", line 20, in execute
current_profile = check_output(shlex.split('az cloud show --query profile -otsv')).decode('utf-8').strip()
File "C:\Users\trpresco\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Users\trpresco\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\trpresco\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\trpresco\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

# Fixed code
def deployment_validate_table_format(result):
    if result.get("error", None):
        error_result = OrderedDict()
        error_result["result"] = result["error"]["code"]
        try:
            tracking_id = re.match(
                r".*(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})", str(result["error"]["message"])
            ).group(1)
            error_result["trackingId"] = tracking_id
        except:  # pylint: disable=bare-except
            pass
        try:
            error_result["message"] = result["error"]["details"][0]["message"]
        except:  # pylint: disable=bare-except
            error_result["message"] = result["error"]["message"]
        return error_result
    elif result.get("properties", None):
        success_result = OrderedDict()
        success_result["result"] = result["properties"]["provisioningState"]
        success_result["correlationId"] = result["properties"]["correlationId"]
        return success_result
    return result