def release_parts(version):
    """
    Split RPM Release string into (numeric X.Y.Z part, milestone, rest).

    :returns: a three-element tuple (number, milestone, rest). If we cannot
              determine the "milestone" or "rest", those will be an empty
              string.
    """
    numver, tail = version_parts(version)
    if numver and not re.match(r'\d', numver):
        # entire release is macro a la %{release}
        tail = numver
        numver = ''
    m = re.match(r'(\.?(?:%\{\?milestone\}|[^%.]+))(.*)$', tail)
    if m:
        milestone = m.group(1)
        rest = m.group(2)
    else:
        milestone = ''
        rest = tail
    return numver, milestone, rest