def get_files_by_file_size(dirname, reverse=False):
    """ Return list of file paths in directory sorted by file size """
filepaths = []
for basename in os.listdir(dirname):
    filename = os.path.join(dirname, basename)
if os.path.isfile(filename):
    filepaths.append(filename)
for i in range(len(filepaths)):
    filepaths[i] = filepaths[i], os.path.getsize(filepaths[i])
filepaths.sort(key=lambda filename: filename[1], reverse=reverse)
for i in range(len(filepaths)):
    filepaths[i] = filepaths[i][0]
Get files from Directory Argument, Sorting by Size