def remove_input_link(self, process_code, input_code):

        """
        Remove an input (technosphere or biosphere exchange) from a process, resolving all parameter issues
        """
        # 1. find correct process
        # 2. find correct exchange
        # 3. remove that exchange
        # 4. check for parameter conflicts?
        # 4. run parameter scan to rebuild matrices?
        
        #print(process_code, input_code)
        
        process = self.database['items'][process_code]
        exchanges = process['exchanges']
        
        initial_count = len(exchanges)
        
        new_exchanges = [e for e in exchanges if e['input'] != input_code]
        
        product_code = [e['input'] for e in exchanges if e['type'] == 'production'][0]
        
        #print(product_code)
        
        param_id = [k for k, v in self.params.items() if (v['from'] == input_code[1] and v['to'] == product_code[1])][0]
        
        #print (param_id)
        
        problem_functions = self.check_param_function_use(param_id)
        
        if len(problem_functions) != 0:
            #print('the following functions have been removed:')
            for p in problem_functions:
                self.params[p[0]]['function'] = None
                #print(p)

        process['exchanges'] = new_exchanges

        del self.params[param_id]

        self.parameter_scan()

        return initial_count - len(new_exchanges)
Remove an input (technosphere or biosphere exchange) from a process, resolving all parameter issues