pathlib is a nice way of handling pathnames, filenames and directories.
arrow is nice for handling various date and time calculations.
Preliminaries:
>>> class Attachment:
... pass
...
>>> attachment = Attachment()
>>> attachment.FileName = 'hello.pdf'
>>> import pathlib
>>> import arrow
Create the required date. Split it into its component pieces in p
. Assemble the required pieces, including a suitably formatted date into the new filename.
>>> a_date = arrow.get('2017-07-05', 'YYYY-MM-DD')
>>> p = pathlib.PurePath(attachment.FileName)
>>> attachment.FileName = p.stem + a_date.format('_MMMMD') + p.suffix
>>> attachment.FileName
'hello_July5.pdf'