def METHOD_NAME(json_file, test=None):
    """
    Returns a dict with needed packages based on a JSON file.
    If a test is specified it will return the dict just for that test.
    """
    needed_packages = {}
    with open(json_file) as f:
        test_packages = json.load(f)
    for key,value in test_packages.items():
        needed_packages[key] = value
    if test:
        if test in needed_packages:
            needed_packages = needed_packages[test]
        else:
            needed_packages = {}
    return needed_packages