<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_str(action: str, resource: str=None):
 """Return a scope based on the supplied action and resource. :param action: the scope action eg. read, write or admin :param resource: the specific resource of the scope, if any eg. alerts, blackouts, heartbeats, users, perms, customers, keys, webhooks, oembed, management or userinfo or None :return: Scope """

        if resource:
            return Scope('{}:{}'.format(action, resource))
        else:
            return Scope(action)