Given a number represented as a string in base 10, how do you convert it into base 7?
Implement the conversion without converting the entire input to a built-in integer, so the method supports values larger than native numeric types. Preserve a leading minus sign for negative inputs and normalize leading zeros.
Input: A string containing an optional - followed by decimal digits. Output: Its base-7 representation as a string.
def convert_to_base7(num):