Duplicate ticket created while run the python script

We can automation script which create jira from zendesk ticket. sometimes it creates multiple duplicate jira tickets and sometime it works perfectly.
Due to duplication of jira ticket , it creates confusion among developers
Please look at the script and let us know

We are using python library called “jira”

from jira import JIRA
from zenpy.lib.api_objects import CustomField, Comment
from jira.exceptions import JIRAError

viu_jira = {‘server’: ‘https://vuclipdev.atlassian.net’} # jira server URL

jira = JIRA(basic_auth=(str(jira_user), str(jira_password)),
options=viu_jira) # Jira connection object

summary = summary + " - ZendeskId: " + str(ticketid)

jiraid = jira.create_issue(project=‘VIUL2’, summary=str(summary),
description=desc, issuetype={‘name’: ‘Support Ticket’},
assignee={‘name’: reporter},
labels=[‘zendesk_esclation’, ‘Insup’],
priority={‘name’: priority})

please reply with proper solutions