'Creates a Pub/Sub topic, if it does not already exist.
:param project: the GCP project name or ID in which to create
the topic
:type project: string
:param topic: the Pub/Sub topic name to create; do not
include the \'projects/{project}/topics/\' prefix.
:type topic: string
:param fail_if_exists: if set, raise an exception if the topic
already exists
:type fail_if_exists: bool'

def create_topic(self, project, topic, fail_if_exists=False):

    service = self.get_conn()
    full_topic = _format_topic(project, topic)
    try:
        service.projects().topics().create(name=full_topic, body={}).execute()
    except errors.HttpError as e:
        if (str(e.resp['status']) == '409'):
            if fail_if_exists:
                raise Exception(('Error    creating    topic.    Topic    already    exists:    %s' % full_topic))
        else:
            raise Exception(('Error    creating    topic    %s' % full_topic), e)
