<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_type(source: SourceType, **options: dict) -> TypeNode: """Parse the AST for a given string containing a GraphQL Type. Throws GraphQLError if a syntax error is encountered. This is useful within tools that operate upon GraphQL Types directly and in isolation of complete GraphQL documents. Consider providing the results to the utility function: `type_from_ast()`. """

    if isinstance(source, str):
        source = Source(source)
    lexer = Lexer(source, **options)
    expect_token(lexer, TokenKind.SOF)
    type_ = parse_type_reference(lexer)
    expect_token(lexer, TokenKind.EOF)
    return type_