nodes: 0, module; 1, function_definition; 2, function_name:scan_for_spec; 3, parameters; 4, block; 5, identifier:keyword; 6, expression_statement; 7, comment:# Both 'spec' formats are wrapped in parens, discard; 8, expression_statement; 9, comment:# First, test for intermediate '1.2+' style; 10, expression_statement; 11, if_statement; 12, comment:# Failing that, see if Spec can make sense of it; 13, try_statement; 14, comment:"""
      Attempt to return some sort of Spec from given keyword value.
  
      Returns None if one could not be derived.
      """; 15, assignment; 16, assignment; 17, identifier:matches; 18, block; 19, block; 20, comment:# I've only ever seen Spec fail with ValueError.; 21, except_clause; 22, identifier:keyword; 23, call; 24, identifier:matches; 25, call; 26, return_statement; 27, return_statement; 28, identifier:ValueError; 29, block; 30, attribute; 31, argument_list; 32, attribute; 33, argument_list; 34, call; 35, call; 36, return_statement; 37, call; 38, identifier:rstrip; 39, string; 40, identifier:release_line_re; 41, identifier:findall; 42, identifier:keyword; 43, identifier:Spec; 44, argument_list; 45, identifier:Spec; 46, argument_list; 47, None; 48, attribute; 49, argument_list; 50, string_content:); 51, call; 52, identifier:keyword; 53, identifier:keyword; 54, identifier:lstrip; 55, string; 56, attribute; 57, argument_list; 58, string_content:(; 59, string:">={}"; 60, identifier:format; 61, subscript; 62, identifier:matches; 63, integer:0
code: def scan_for_spec(keyword):
      """
      Attempt to return some sort of Spec from given keyword value.
  
      Returns None if one could not be derived.
      """
      # Both 'spec' formats are wrapped in parens, discard
      keyword = keyword.lstrip('(').rstrip(')')
      # First, test for intermediate '1.2+' style
      matches = release_line_re.findall(keyword)
      if matches:
          return Spec(">={}".format(matches[0]))
      # Failing that, see if Spec can make sense of it
      try:
          return Spec(keyword)
      # I've only ever seen Spec fail with ValueError.
      except ValueError:
          return None