Acccessing attached files

I have this custom app I have been working on, and there is a need to access an attached file with a whitelisted script.
When working in python the working directory is: ~/frappe-bench/sites. This means that in order to access the attached file in a certain docType I need to get the path from the attachment field (e.g.: public/files/name_of_files.pdf) and append the following: /site_name/ before the path.
The problem is that in order to access the file I need the site name or something (to keep it generic enough).
I currently do a workaround:

import fnmatch
import subprocess

s =['find','.'],stdout=subprocess.PIPE)
filepath = fnmatch.filter(s.stdout.decode().split('\n'),'*' + filename)
filepath = filepath[0][1:]
#Do something with file path.
return something

Isn’t there a more elegant way to accomplish this (maybe something like frappe.current_site_name())? Please tell me.