'Returns a list of asset metadata for all assets of the given asset_type in the course.
Args:
course_key (CourseKey): course identifier
asset_type (str): the block_type of the assets to return. If None, return assets of all types.
start (int): optional - start at this asset number. Zero-based!
maxresults (int): optional - return at most this many, -1 means no limit
sort (array): optional - None means no sort
(sort_by (str), sort_order (str))
sort_by - one of \'uploadDate\' or \'displayname\'
sort_order - one of SortOrder.ascending or SortOrder.descending
Returns:
List of AssetMetadata objects.'

@contract(course_key='CourseKey', asset_type='None    |    basestring', start='int    |    None', maxresults='int    |    None', sort='tuple(str,(int,>=1,<=2))|None')
def get_all_asset_metadata(self, course_key, asset_type, start=0, maxresults=(-1), sort=None, **kwargs):

    course_assets = self._find_course_assets(course_key)
    key_func = None
    sort_order = ModuleStoreEnum.SortOrder.ascending
    if sort:
        if (sort[0] == 'uploadDate'):
            key_func = (lambda x: x['edit_info']['edited_on'])
        if (sort[1] == ModuleStoreEnum.SortOrder.descending):
            sort_order = ModuleStoreEnum.SortOrder.descending
    if (asset_type is None):
        all_assets = SortedAssetList(iterable=[], key=key_func)
        for (asset_type, val) in course_assets.iteritems():
            all_assets.update(val)
    else:
        all_assets = SortedAssetList(iterable=course_assets.get(asset_type, []), key=key_func)
    num_assets = len(all_assets)
    start_idx = start
    end_idx = min(num_assets, (start + maxresults))
    if (maxresults < 0):
        end_idx = num_assets
    step_incr = 1
    if (sort_order == ModuleStoreEnum.SortOrder.descending):
        step_incr = (-1)
        start_idx = ((num_assets - 1) - start_idx)
        end_idx = ((num_assets - 1) - end_idx)
    ret_assets = []
    for idx in xrange(start_idx, end_idx, step_incr):
        raw_asset = all_assets[idx]
        asset_key = course_key.make_asset_key(raw_asset['asset_type'], raw_asset['filename'])
        new_asset = AssetMetadata(asset_key)
        new_asset.from_storable(raw_asset)
        ret_assets.append(new_asset)
    return ret_assets
