def get_trade_value(x, sum_use, sector, own_production_ratio=0.8):
    """Function to get the trade value between a certain origin and destination.

    Parameters
        - x - row in Origin-Destination dataframe
        - sum_use - total use in a certain destination
        - own_production_ratio - Specify how much supply and demand is locally supplied and used, and how much is imported/exported. The default is set to **0.8**

    Outputs
        - returns trade value

    """
    if x.Destination == x.Origin:
        try:
            return list(sum_use.loc[(sum_use['region'] == x.Destination) & (sum_use['sector'] == sector)]['value'])[0]*own_production_ratio
        except:
            return 1
    elif x.gdp == 0:
        return 0
    else:
        try:
            return list(sum_use.loc[(sum_use['region'] == x.Destination) & (sum_use['sector'] == sector)]['value'])[0]*(1-own_production_ratio)*x.ratio
        except:
            return 0