def get_binary_representation(n, num_digits):
    """
    Helper function to get a binary representation of items to add to a subset,
    which combinations() uses to construct and append another item to the powerset.
    
    Parameters:
    n and num_digits are non-negative ints
    
    Returns: 
        a num_digits str that is a binary representation of n
    """
    result = ''
    while n > 0:
        result = str(n%2) + result
        n = n//2
    if len(result) > num_digits:
        raise ValueError('not enough digits')
    for i in range(num_digits - len(result)):
        result = '0' + result
    return result