<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse( source: SourceType, no_location=False, experimental_fragment_variables=False ) -> DocumentNode: """Given a GraphQL source, parse it into a Document. Throws GraphQLError if a syntax error is encountered. By default, the parser creates AST nodes that know the location in the source that they correspond to. The `no_location` option disables that behavior for performance or testing. Experimental features: If `experimental_fragment_variables` is set to True, the parser will understand and parse variable definitions contained in a fragment definition. They'll be represented in the `variable_definitions` field of the `FragmentDefinitionNode`. The syntax is identical to normal, query-defined variables. For example:: fragment A($var: Boolean = false) on T { } """

    if isinstance(source, str):
        source = Source(source)
    elif not isinstance(source, Source):
        raise TypeError(f"Must provide Source. Received: {inspect(source)}")
    lexer = Lexer(
        source,
        no_location=no_location,
        experimental_fragment_variables=experimental_fragment_variables,
    )
    return parse_document(lexer)