def convert_to_binary(num, bits):
    """
    Converts number to its binary representation
    :param num: int
    :param bits: str
    :return: str
    """
    if not isinstance(num, int):
        raise ValueError("Invalid number type, num must be of type int.")
    return f'{num:0{bits}b}'