def list_children()

in functions/source/new_account_handler.py [0:0]


def list_children(parent_id, c_type='ORGANIZATIONAL_UNIT'):
    '''
    List all children for a OU
    '''

    result = list()

    try:
        paginator = ORG.get_paginator('list_children')
        iterator = paginator.paginate(ParentId=parent_id,
                                     ChildType=c_type)
    except ClientError as exe:
        LOGGER.error('Unable to get children: %s', str(exe))

    for page in iterator:
        result += page['Children']

    return result