<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def md5_for_file(f, block_size=2 ** 20):
 """Generate an MD5 has for a possibly large file by breaking it into chunks"""

    import hashlib

    md5 = hashlib.md5()
    try:
        # Guess that f is a FLO.
        f.seek(0)

        while True:
            data = f.read(block_size)
            if not data:
                break
            md5.update(data)
        return md5.hexdigest()

    except AttributeError as e:
        # Nope, not a FLO. Maybe string?

        file_name = f
        with open(file_name, 'rb') as f:
            return md5_for_file(f, block_size)