Python: How to define a function that gets a list of strings OR a string
<p>Let's say I want to add a list of strings or just one to a DB:</p>

<pre><code>names = ['Alice', 'Bob', 'Zoe']
</code></pre>

<p>and I want that <code>add_to_db</code> will accept both cases</p>

<pre><code>add_to_db(names)
add_to_db('John')
</code></pre>

<p>Is this the correct way to go:</p>

<pre><code>def add_to_db(name_or_names):
    if (...):
        ... # add a single name
    else:
        for name in name_or_names:
            ... # add a single name
    commit_to_db()
</code></pre>

<p>What should I put in the first <code>...</code>, as condition to whether it's a list of strings or just a string (don't forget that string is also iterable)?</p>
