Home | Legal Tech | Projects | Writings


Download, read, and compare names against the SDN list.

OFAC regulations are a funny thing - you aren't necessarily required to check names in transactions against the SDN, but it may be illegal for your organisation, or people within your organisation, to facilitate a transaction to them. So if you think the regs apply (or even if they might not!) it's a blooming good idea to check it. This script does that for you.


  1. Install a fuzzy matching module
  2. Write the script
  3. Use the script from the terminal

1. Install fuzzywuzzy

The python module we need to install is called 'fuzzywuzzy'.

If you are unsure how to install this module, check the guide at python basics.

2. Write the script

This step is as simple as pasting the code below into a new python file.

Make a new file called ofac.py. In the terminal you can simply enter:

$ touch opac.py

Now open it in your favourite text editor and enter the following:

3. Use the script from the terminal

Open your terminal, and go to the directory you saved ofac.py in. Use the cd command to change directories.

Check the script is indeed in your current director by ensuring the filename is lister there when you run the list command:

$ ls -l

Now run the script by entering the following:

$ python3 ofac.py

If you entered the script correctly, you should see it prompt you for a name. Add it in, and don't worry about capitalisation, the script takes care of that automatically.

One you've entered the name, you should see the fuzzy matches appear. You can adjust the sensitivy by changing the value of the sensitivity variable near the top of the script.

Of course, this is a really basic check, but can be easily adapted to different purposes, such as processing an entire list of names rather than one at a time.