code: def _to_roman(num):
      
      roman_numeral_map = (
          ('M',  1000),
          ('CM', 900),
          ('D',  500),
          ('CD', 400),
          ('C',  100),
          ('XC', 90),
          ('L',  50),
          ('XL', 40),
          ('X',  10),
          ('IX', 9),
          ('V',  5),
          ('IV', 4),
          ('I',  1)
      )
      if not (0 < num < 5000):
          log(WARN, 'Number out of range for roman (must be 1..4999)')
          return str(num)
      result = ''
      for numeral, integer in roman_numeral_map:
          while num >= integer:
              result += numeral
              num -= integer
      return result
docs: Convert integer to roman numerals.