Create a wrapper function that passes a variable, in this case, your intended frame. You can also combine lines 2 & 3.
Code:
local player_frame = MyAddOn:SkinFrame(PlayerFrame)
local target_frame = MyAddOn:SkinFrame(TargetFrame)
function MyAddOn:SkinFrame(frame)
local bg = CreateFrame('Frame', nil, frame)
bg:SetPoint('TOPLEFT', frame, "BOTTOMRIGHT", 0, -26)
-- do the rest of your code here
return frame -- returns your skinned frame
end