<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_buffer(buffer, mime=False):
 """ Accepts a binary string and returns the detected filetype. Return value is the mimetype if mime=True, otherwise a human readable name. 'PDF document, version 1.2' """

    m = _get_magic_type(mime)
    return m.from_buffer(buffer)