title: Try/except if an element of a list exists
body: <p><strong>The problem</strong></p>
  
  <p>I have the following list in Python 3.6</p>
  
  <pre><code>Piko = {}
  Piko['Name']='Luke'
  </code></pre>
  
  <p>I am trying to write a function that give the value of the element if it exist and is set and give <code>None</code> otherwise.
  For example:</p>
  
  <ul>
  <li>INPUT: <code>isset(Piko['Name'])</code> OUTPUT: <code>Luke</code></li>
  <li>INPUT: <code>isset(Piko['Surname'])</code> OUTPUT: <code>None</code></li>
  </ul>
  
  <p><strong>What I have tried</strong></p>
  
  <p>1st try; based on my know how:</p>
  
  <pre><code>def isset1(x):
      try:
          x
      except KeyError:
          print(None)
      else:
          print(x)
  </code></pre>
  
  <p>2nd try; based on <a href="https://stackoverflow.com/a/11786240/1008588">this</a> answer:</p>
  
  <pre><code>def isset2(x):
      try:
          t=x
      except IndexError:
          print(None)
  </code></pre>
  
  <p>3rd try; based on <a href="https://stackoverflow.com/a/16154204/1008588">this</a> answer:</p>
  
  <pre><code>def isset3(x):
      try:
          x
      except Exception:
          print(None)
      else:
          print(x)
  </code></pre>
  
  <p>Any one of the previous gives me <code>KeyError: 'Surname</code>' error and does not output <code>None</code> as I wanted. Can anybody help me explaining how could I manage correctly the <code>KeyError</code>?</p>