Edit Python Script about painting surfaces

Can anyone help me please to edit this python script, to make it paint even if the face is painted, because i noticed (but i am not sure) that this script will not paint a painted face…
Thanks in advance

Copyright(c) René Castillo Picazo

México 2017

cadesigner.mex@gmail.com

import clr

clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitServices’)

import Autodesk
import RevitServices

from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

surfaces = IN[0]
material = UnwrapElement(IN[1])

def PaintFace(surf, mat):
if not isinstance(surf, list):
elemRef = surf.Tags.LookupTag(‘RevitFaceReference’)
elem = doc.GetElement(elemRef)
face = elem.GetGeometryObjectFromReference(elemRef)
if not (doc.IsPainted(elem.Id, face)):
doc.Paint(elem.Id, face, mat.Id)
return surf
else:
[PaintFace(i, mat) for i in surf]
return surf

TransactionManager.Instance.EnsureInTransaction(doc)

OUT = PaintFace(surfaces, material)

TransactionManager.Instance.TransactionTaskDone()

Maybe try removing paint then painting after if it doesnt support painting painted faces?

i believe there is a line or a some commands can be removed from this script to paint even if face is painted