input: Write a function to convert a number into its binary representation as a string. The function should handle cases where the input number is 0 by returning it as '0'. Additionally, the function should handle negative numbers by converting them to their two's complement binary representation.
  
  def convert_to_binary(num):
      if num == 0:
          return '0'
      elif num < 0:
          num = 2**32 + num
      binary = ''
      while num > 0:
          binary = str(num % 2) + binary
          num //= 2
      return binary
  
  assert convert_to_binary(0) == '0'
  assert convert_to_binary(10) == '1010'
  assert convert_to_binary(-10) == '11111111111111111111111111110110'
  assert convert_to_binary(255) == '11111111'
  assert convert_to_binary(-255) == '11111111111111111111111100000001'
output: def convert_to_binary(num):
      if num == 0:
          return '0'
      elif num < 0:
          num = 2**32 + num
      binary = ''
      while num > 0:
          binary = str(num % 2) + binary
          num //= 2
      return binary