human
I wrote the below code

    normalize = (lambda x: (str(x).split(':', 1)[(-1)] if ignore_epoch else str(x)))
    ver1 = normalize(ver1)
    ver2 = normalize(ver2)
    try:
        cmp_func = None
        if HAS_RPM:
            try:
                cmp_func = rpm.labelCompare
            except AttributeError:
                log.debug('rpm    module    imported,    but    it    does    not    have    the    labelCompare    function.    Not    using    rpm.labelCompare    for    version    comparison.')
        if ((cmp_func is None) and HAS_RPMUTILS):
            try:
                cmp_func = rpmUtils.miscutils.compareEVR
            except AttributeError:
                log.debug('rpmUtils.miscutils.compareEVR    is    not    available')
        if (cmp_func is None):
            if salt.utils.path.which('rpmdev-vercmp'):
                def _ensure_epoch(ver):
                    def _prepend(ver):
                        return '0:{0}'.format(ver)
                    try:
                        if (':' not in ver):
                            return _prepend(ver)
                    except TypeError:
                        return _prepend(ver)
                    return ver
                ver1 = _ensure_epoch(ver1)
                ver2 = _ensure_epoch(ver2)
                result = __salt__['cmd.run_all'](['rpmdev-vercmp', ver1, ver2], python_shell=False, redirect_stderr=True, ignore_retcode=True)
                if (result['retcode'] == 0):
                    return 0
                elif (result['retcode'] == 11):
                    return 1
                elif (result['retcode'] == 12):
                    return (-1)
                else:
                    log.warning('Failed    to    interpret    results    of    rpmdev-vercmp    output.    This    is    probably    a    bug,    and    should    be    reported.    Return    code    was    %s.    Output:    %s', result['retcode'], result['stdout'])
            else:
                log.warning('rpmdevtools    is    not    installed,    please    install    it   ...

What's a good function header?

Write me a Python code to compare    function?
assistant
#Here is Python code to compare    function.

def version_cmp(ver1, ver2, ignore_epoch=False):