<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ls(directory, long_format, recursive):
 """List contents of a directory on the board. Can pass an optional argument which is the path to the directory. The default is to list the contents of the root, /, path. For example to list the contents of the root run: ampy --port /board/serial/port ls Or to list the contents of the /foo/bar directory on the board run: ampy --port /board/serial/port ls /foo/bar Add the -l or --long_format flag to print the size of files (however note MicroPython does not calculate the size of folders and will show 0 bytes):
 ampy --port /board/serial/port ls -l /foo/bar """

    # List each file/directory on a separate line.
    board_files = files.Files(_board)
    for f in board_files.ls(directory, long_format=long_format, recursive=recursive):
        print(f)