import uuid


def issue(self, message, exc=None):
    """Accepts a message that will be logged with an additional reference
    code for easy log lookup.

    The identifier will be returned for inclusion in user-visible
    error messages.
    """
    ref = str(uuid.uuid1())

    if exc is None:
        err_message = "{}. Ref: {}".format(message, ref)
    else:
        err_message = "{} : {}. Ref: {}".format(
            message, str(exc), ref)

    self.error(err_message)
    return ref