def hex(number, prefix='0x'):
    """
  Converts a integer value to its hexadecimal representation.

  :param number:
      Integer value.
  :param prefix:
      The prefix to use for the hexadecimal string. Default "0x" to mimic
      ``hex()``.
  :returns:
      Hexadecimal string.
  """
    prefix = prefix or ''
    if number < 0:
        number = -number
        prefix = '-' + prefix
    _ = number & 1
    hex_num = '%x' % number
    return prefix + hex_num.lower()
