def remove_from_build(arg_modules, arg_extras):
    ' Given a list of modules from command line, remove modules that appear in module\n        directory that are not in list.\n    '

    def remove_from_running_pool():
        ' Remove modules from running pool if they are not in modules list from argument '
        copy_of_modules = []
        for module in modules.run_ptr:
            if (module['name'].lower() in arg_modules):
                copy_of_modules.append(module)
        modules.run_ptr = copy_of_modules

    def remove_from_menu():
        ' Remove modules from menu if they are not in modules list from argument '
        copy_of_menu = []
        for module in modules.menu_ptr:
            if (module['name'].lower() in arg_modules):
                copy_of_menu.append(module)
        modules.menu_ptr = copy_of_menu
    if arg_extras:
        arg_modules = (arg_modules + arg_extras)
    remove_from_running_pool()
    remove_from_menu()
Given a list of modules from command line, remove modules that appear in module
directory that are not in list.
def remove_from_build(arg_modules, arg_extras):
    ' Given a list of modules from command line, remove modules that appear in module\n        directory that are not in list.\n    '

    def remove_from_running_pool():
        ' Remove modules from running pool if they are not in modules list from argument '
        copy_of_modules = []
        for module in modules.run_ptr:
            if (module['name'].lower() in arg_modules):
                copy_of_modules.append(module)
        modules.run_ptr = copy_of_modules

    def remove_from_menu():
        ' Remove modules from menu if they are not in modules list from argument '
        copy_of_menu = []
        for module in modules.menu_ptr:
            if (module['name'].lower() in arg_modules):
                copy_of_menu.append(module)
        modules.menu_ptr = copy_of_menu
    if arg_extras:
        arg_modules = (arg_modules + arg_extras)
    remove_from_running_pool()
    remove_from_menu()