def load(fp, expand_includes=True, include_position=False, include_comments=False, **kwargs):
p = Parser(expand_includes=expand_includes,<EOL>include_comments=include_comments, **kwargs)<EOL>ast = p.load(fp)<EOL>m = MapfileToDict(include_position=include_position,<EOL>include_comments=include_comments, **kwargs)<EOL>d = m.transform(ast)<EOL>return d<EOL>
Load a Mapfile from an open file or file-like object.

Parameters
----------

fp: file
    A file-like object - as with all Mapfiles this should be encoded in "utf-8"
expand_includes: boolean
    Load any ``INCLUDE`` files in the MapFile
include_comments: boolean
     Include or discard comment strings from the Mapfile - *experimental*
include_position: boolean
     Include the position of the Mapfile tokens in the output

Returns
-------

dict
    A Python dictionary representing the Mapfile in the mappyfile format

Example
-------

To open a Mapfile from a file and return it as a dictionary object::

    with open('mymap.map') as fp:
        d = mappyfile.load(fp)

Notes
-----

Partial Mapfiles can also be opened, for example a file containing a ``LAYER`` object.